Back  

Variables


Variables are used to store values that will change throughout the execution of the program.

int types are used to store integer eg: 3

double types are used to store floating value, it can also store integer too eg: 3.1415, 3.0

char types are used to store single character eg: 'a'

boolean types are used to store true/false value eg: true


An unique variable name is assigned to a variable type to serve as identifier

int a = 5;

Practice

using namespace std ;

int a = ;

double b = ;

char c = ' ' ;

boolean d = ;

cout<<" a = "<< a << endl ;

cout<<" b = "<< b << endl ;

cout<<" c = "<< c << endl ;

cout<<" d = "<< noboolalpha << d << endl ;

Output

a =

b =

c =

d = true