c++ all types of variables code example
Example 1: c++ declare variable
std::string str = "text";
int foo = 3;
float bar = 3.14;
double baz = 3.14159265;
Example 2: All data types in C++
Data Type Size
int (Integer) = 5, 6, 7 2
float (Floating Value) = -3.67, 2.67 4
double (Double of float) = -7.8746 8
char (Character) = 'a', 'b', 'A' 1
string (Multiple chars) = "Hello World" No of Chars
bool (Boolean) = true, false true = 1, false = 0
Example 3: variabvles in c++
#include <iostream>
using namespace std
int main{
int x = 3;
float g = 4.0;
long h = 1234567;
double j = 1237886.099;
cout<<x<<endl;
cout<<h<<endl;
cout<<g<<endl;
cout<<j<<endl;
}