REFRENCE VARIABLES & TYPECASTINGS
#include<iostream>
using namespace std;
int main(){
int a,b,c;
cout<<"Enter the value of a"<<endl;
cin>>a;
cout<<"Enter the value of b"<<endl;
cin>>b;
cout<<"The value of a is "<<a<<endl;
cout<<"The value of b is "<<b<<endl;
cout<<"The value of c is "<<a+b<<endl;
cout<<"\n";
//use of sizeof()keyword// use of f and l in float and long double;//
//****use of float, double, long double, literals********//
cout<<"\n";
float x =10.5;
long double y=90.5;
cout<<"The size of x is "<<sizeof(10.5)<<endl;
cout<<"The size of y is "<<sizeof(90.5)<<endl;
cout<<"The size of xl is "<<sizeof(10.5l)<<endl;
cout<<"The size of xf is "<<sizeof(90.5f)<<endl;
cout<<"\n";
//*********...refrence variables starting....**********//
float that=889.5;
float y=that;
cout<<y<<endl;
cout<<that<<endl;
//*********...Typecasting starting....**********//
int a=45.85;
cout<<(float)a<<endl;
float b=90.5;
cout<<(int)b<<endl;
return 0;
}
Comments
Post a Comment