// Fundamental_types.cpp - understanding basics of fundamental types in c++ //#include "stdafx.h" #include #include using namespace std; int main() { //Different ways of declaring the variables int int1 = 1; cout << "The variable 1 is " << int1 << endl; int int2; int2 = 2; cout << "The variable 2 is " << int2 << endl; int int3(3); cout << "The variable 3 is " << int3 << endl; int int4{ 4 }; cout << "The variable 4 is " << int4 << endl; double double1 = 2.2; double double2 = int1; cout << "The double variable 1 is " << double1 << endl; cout << "The double variable 2 is " << double2 << endl; int int5 = double1; cout << "The integer variable 5 is " << int5 << endl; char a = 'H'; //char a = "H";//double quotes indicates a string which is collection of chars cout << "The char variable is " << a << endl; bool flag = false; cout << "The boolean variable is " << flag << endl; flag = int1; //any non-zero values are converted to True cout << "The boolean variable is " << flag << endl; //declaring variables with a word auto auto a1 = 3; auto a2 = 3.14; auto a3 = 'a'; auto a4 = false; auto a5 = 10000000000000000000; a1 = a2; cout << a1 << endl; //Casting int int6 = 3; double d1 = 3.14; //int6 = d1; int6 = static_cast(d1); system("pause"); return 0; }