constants,manupulators and operator precedence
#include <iostream>
#include<iomanip>
using namespace std;
int main()
{
int a=4,b=56,c=67;
const int y=9;
// y=10; it cannot happen as y is a constant
cout<<"The value of y is:"<<y;
cout<<"\nThe value of ab is:"<<a;
cout<<"\nThe value of b is:"<<b;
cout<<"\nThe value of c is:"<<c;
//********************manipulation operator*****endl and setw***************************
cout<<"\n\nThe value of a using setw is:"<<setw(4)<<a;
cout<<"\nThe value of b using setw is:"<<setw(4)<<b;
cout<<"\nThe value of c using setw is:"<<setw(4)<<c;
//***********************Operator precedence*******************************
int z= ((((a*5)+b)-45)+87);
cout<<"\nThe value of z is:"<<z;
return 0;
}
Comments
Post a Comment