// This tut contains Built in data types,Reference variables and Typecasting
#include<iostream>
using namespace std;
// ******************Built in data types**********************
int c=45;
int main(){
// int a,b,c;
// cout<<"Enter the value of a :";
// cin>>a;
// cout<<"Enter the value of b :";
// cin>>b;
// c= a + b;
// cout<<"The value of sum is :"<<c<<endl;
// cout<<"The value of global c is :"<<::c<<endl;
//*******************Reference variables***********************
// float x=34.67;
// float & y=x;
// cout<<x<<endl;
// cout<<y<<endl;
//******************Typecasting******************************
int p=45;
float f=25.64;
cout<<"The float value of p is :"<<(float)p<<endl;
cout<<"The float value of p is :"<<float(p)<<endl;
cout<<"The int value of f is :"<<(int)f<<endl;
cout<<"The int value of f is :"<<int(f)<<endl;
int t= int(f);
cout<<"The expression is"<<p+f<<endl;
cout<<"The expression is"<<p+int(f)<<endl;
cout<<"The expression is"<<p+(int)f<<endl;
return 0;
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.