#include <iostream>
int main()
{
std::cout << "Hellooo" << endl;
}
#include <iostream>
int main()
{
int a;
int b;
int c;
a = 3;
b = 5;
c = a + b;
std::cout << "Sum is " << c;
}
#include <iostream>
using namespace std;
int main()
{
cout << "\n\n Find Size of fundamental data types :\n";
cout << "------------------------------------------\n";
cout << " The sizeof(char) is : " << sizeof(char) << " bytes \n";
cout << " The sizeof(short) is : " << sizeof(short) << " bytes \n";
cout << " The sizeof(int) is : " << sizeof(int) << " bytes \n";
cout << " The sizeof(long) is : " << sizeof(long) << " bytes \n";
cout << " The sizeof(long long) is : " << sizeof(long long) << " bytes \n";
cout << " The sizeof(float) is : " << sizeof(float) << " bytes \n";
cout << " The sizeof(double) is : " << sizeof(double) << " bytes \n";
cout << " The sizeof(long double) is : " << sizeof(long double) << " bytes \n";
cout << " The sizeof(bool) is : " << sizeof(bool) << " bytes \n\n";
return 0;
}
#include <iostream>
#include <climits> // integer limits in header file
using namespace std;
int main()
{
cout << "\n\n Check the upper and lower limits of integer :\n";
cout << "--------------------------------------------------\n";
cout << " The maximum limit of int data type : " << INT_MAX << endl;
cout << " The minimum limit of int data type : " << INT_MIN << endl;
cout << " The maximum limit of unsigned int data type : " << UINT_MAX << endl;
cout << " The maximum limit of long long data type : " << LLONG_MAX << endl;
cout << " The minimum limit of long long data type : " << LLONG_MIN << endl;
cout << " The maximum limit of unsigned long long data type : " << ULLONG_MAX << endl;
cout << " The Bits contain in char data type : " << CHAR_BIT << endl;
cout << " The maximum limit of char data type : " << CHAR_MAX << endl;
cout << " The minimum limit of char data type : " << CHAR_MIN << endl;
cout << " The maximum limit of signed char data type : " << SCHAR_MAX << endl;
cout << " The minimum limit of signed char data type : " << SCHAR_MIN << endl;
cout << " The maximum limit of unsigned char data type : " << UCHAR_MAX << endl;
cout << " The minimum limit of short data type : " << SHRT_MIN << endl;
cout << " The maximum limit of short data type : " << SHRT_MAX << endl;
cout << " The maximum limit of unsigned short data type : " << USHRT_MAX << endl;
cout << endl;
return 0;
}
#include <iostream>
#include <iomanip> // formatting floating-point numbers with 1 decimal place
using namespace std;
int main()
{
float m1=22, m2=7; // important
cout << fixed << setprecision(3);
cout << " " << m1 << " + " << m2 << " = " << m1 / m2 << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a, b; // a=5,b=2
cin >> a >> b;
a = a + b; // a=7
b = a - b; // b=5
a = a - b; // a=2
cout << a << b;
return 0;
}
#include <iostream>
#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;
int main()
{
time_t t = time(NULL);
tm *tPtr = localtime(&t);
cout << "\n\n Display the Current Date and Time :\n";
cout << "----------------------------------------\n";
cout << " seconds = " << (tPtr->tm_sec) << endl;
cout << " minutes = " << (tPtr->tm_min) << endl;
cout << " hours = " << (tPtr->tm_hour) << endl;
cout << " day of month = " << (tPtr->tm_mday) << endl;
cout << " month of year = " << (tPtr->tm_mon) + 1 << endl;
cout << " year = " << (tPtr->tm_year) + 1900 << endl;
cout << " weekday = " << (tPtr->tm_wday) << endl;
cout << " day of year = " << (tPtr->tm_yday) << endl;
cout << " daylight savings = " << (tPtr->tm_isdst) << endl;
cout << endl;
cout << endl;
cout << " Current Date: " << (tPtr->tm_mday) << "/" << (tPtr->tm_mon) + 1 << "/" << (tPtr->tm_year) + 1900 << endl;
cout << " Current Time: " << (tPtr->tm_hour) << ":" << (tPtr->tm_min) << ":" << (tPtr->tm_sec) << endl;
cout << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int array1[] = {1, 2, 3, 4, 5, 6, 7, 8};
int *eo;
int s1 = sizeof(array1) / sizeof(array1[0]);
cout << s1 << sizeof(array1) << sizeof(array1[0]);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
char sing_ch;
cout << "\n\n Print code (ASCII code / Unicode code etc.) of a given character:\n";
cout << "-----------------------------------------------------------------------\n";
cout << " Input a character: ";
cin >> sing_ch;
cout << " The ASCII value of " << sing_ch << " is: " << (int)sing_ch << endl;
cout << " The character for the ASCII value " << (int)sing_ch << " is: " << (char)((int)sing_ch) << endl;
return 0;
}
#include <iostream>
int main()
{
int n = 102;
int i=0;
while (n > 0)
{
i = (n % 10) + i * 10;
n = n / 10;
}
std::cout << i; // Outputs "201"
return 0;
}
#include <iostream>
#include<iomanip>
using namespace std;
int main()
{
int N = 20;
int n = 1;
for (int i = 0; i < N; i++)
{
for (int j = 0; j <= i; j++)
{
cout <<setw(3)<< n << " ";
n++;
}
cout << endl;
}
return 0;
}
template