Variable in C++

 Here We will use the variable as Integer, Character, Double, Float and String using a, b, c, d, e respectively. Here We will print Each Variable respectively.

First we will Print it using cout<<

#include<iostream>

using namespace std;

int main(){

int a=25; //This is integer Variable

char b= 'C'; //This is character Variable

double c=34.98; // this is Double Variable

float d=70.52; // This is Float

string e= "Hello"; // This is String

char f[10]="Namastey"; // This String is used as C Programming 


cout<<a;

cout<<endl;

cout<<b;

cout<<endl;

cout<<c;

cout<<endl;

cout<<d;

cout<<endl;

cout<<e;

cout<<endl;

cout<<f;

cout<<endl;

cout<< "we are using it in reverse order";

/*Or else we can write it as*/


cout<<f<<endl<<e<<endl<<d<<endl<<c<<endl<<b<<endl<<a;

return 0;}


This will give following Output.


0 Comments had been done yet:

Post a Comment