C++ Program to initialize different datatypes and print the same on terminal
Program
#include<iostream>
using namespace std;
int main()
{
int i;
float f;
double d;
char ch;
bool b_tr, b_fl;
i = 12;
cout << "The value of integer data type is: " << i << endl;
f = 72.292;
cout << "The value of floating-point data type is: " << f << endl;
d = 87443612.32945;
cout << "The value of double precision data type is: " << d << endl;
ch = 'p';
cout << "The value of character data type is: " << ch << endl;
b_tr = true;
cout << "The value of bool data type is: " << b_tr << endl;
b_fl = false;
cout << "The value of bool data type is: " << b_fl << endl;
return 0;
}
Output
The value of integer data type is: 12
The value of floating-point data type is: 72.292
The value of double precision data type is: 8.74436e+07
The value of character data type is: p
The value of bool data type is: 1
The value of bool data type is: 0