-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6referencevariables_typecasting.cpp
More file actions
40 lines (34 loc) · 1.12 KB
/
Copy path6referencevariables_typecasting.cpp
File metadata and controls
40 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
using namespace std;
int c = 55;
int main(){
// int a, b, c;
// cout<<"entre the value of a: "<<endl;
// cin>>a;
// cout<<"entre the value of b: "<<endl;
// cin>>b;
// c=a+b;
// cout<<"the sum is c \n"<<::c; // using :: made c as global varibale.
//*************difference between float and long double***********
// float d= 33.78f;
// long double e= 33.78l;
// // put f at end of a float to define it else a float else commpiler will read it as long double
// // u can do this with long double aswell by putting l at end.
// cout<<"the value of d is "<<d<<"\n"<<"the value of e is "<<e<<endl;
// cout<<"the size of 33.78 is "<<sizeof(33.78)<<endl;
// cout<<"the size of 33.78f is "<<sizeof(33.78f)<<endl;
// cout<<"the size of 33.78F is "<<sizeof(33.78F)<<endl;
// cout<<"the size of 33.78l is "<<sizeof(33.78l)<<endl;
// cout<<"the size of 33.78L is "<<sizeof(33.78L)<<endl;
// ****reference variable***
// float x= 333;
// float & y= x;
// cout<<x<<endl;
// cout<<y;
//*****typecasting********
int a= 39;
float b= 67.88;
cout<<"the value of a is: "<<(float)a<<endl;
cout<<"the value of b is: "<<(int)b;
return 0;
}