C++ Variables and their types  - C++ tutorials

                          Bestitworriors





C++ Variables and their types







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

  1. Variables use to store data
  2. C++ variable declear with datatype of variable
  3. Data types must be declear in c++ variables
  4. C++ also support constant variable define as const int variable_name
  5. Int variable declear with int variable_name
  6. Double variable declear with double variable_name
  7. String variable declear with string variable_name
  8. 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





I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back