In c++ there are different type of variable
int
- stores integers (whole numbers), without decimals, such as 123 or -123double
- stores floating point numbers, with decimals, such as 19.99 or -19.99char
- stores single characters, such as 'a' or 'B'. Char values are surrounded by single quotesstring
- stores text, such as "Hello World". String values are surrounded by double quotesbool
- stores values with two states: true or false
How To Create A Variable??
Syntax:-
type variable = value;
For Multiple Variable
int x = 5;
int y = 6;
int sum = x + y;
cout << sum;
int y = 6;
int sum = x + y;
cout << sum;
Other Type Of Variables
int myNum = 5; // Integer (whole number without decimals)
double myFloatNum = 5.99; // Floating point number (with decimals)
char myLetter = 'D'; // Character
string myText = "Hello"; // String (text)
bool myBoolean = true; // Boolean (true or false)
0 Comments
if you have any doubts.Please let me know