C++ Variables and their types - C++ tutorials
Bestitworriors
C++ Variables and their types - C++ tutorials Bestitworriors - Variables are use to store data or information in them and perform some operation.Variables have different types and their relevent data.C++ sopport int,double,string,char,bool types variables.In C++ variables decleare with its type like integer variables with int variable_name and double variable decleare with bouble variable_name and character variable decleare with char variable_name and text variable declear with string variable_name and bool variable decleare with bool variable_name.
Some Key Points of C++ Variables
- Variables use to store data
- C++ variable declear with datatype of variable
- Data types must be declear in c++ variables
- C++ also support constant variable define as const int variable_name
- Int variable declear with int variable_name
- Double variable declear with double variable_name
- String variable declear with string variable_name
- Bool variable declear with bool variable_name
Code
# include <iostream>
using namespace std;
int main()
{
int integernumber = 10;
double floatnumber = 5.99;
char letter = 'D';
string text = "Hello";
bool boolean = true;
const int minutes = 60;
const float PI = 3.14;
cout << integernumber;
cout << endl;
cout << floatnumber;
cout << endl;
cout << letter;
cout << endl;
cout << text;
cout << endl;
cout << boolean;
cout << endl;
cout << minutes;
cout << endl;
cout << PI;
cout << endl;
return 0;
}
OutPut
10
5.99
D
Hello
1
60
3.14
0 Comments