Thursday, 13 October 2016

Declaration & initiallization of Variable and printing its value

#include<iostream>
using namespace std;
int main()
{
int a=5;

   //declaration and initiallization of integer variable

cout<<"Hardcode value : "<< a <<endl;

 //print message and printing value of variable

int b=0;  

 //declaration and initiallization of integer variable

cin>>b; // taking input in a variable

cout<<"User Input value : "<<b<<endl;  

//print message and printing value of variable

return 0;
}

First Code C++ Hellow World!

#include<iostream>       //adding headerfile
using namespace std;
int main()
{
      cout<<"Hellow World!"<<endl;

       //endl means next line/break


      //cout is used to print and << is insertion operator


      return 0;
}