-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypecasting.cpp
More file actions
75 lines (51 loc) · 1.7 KB
/
Copy pathtypecasting.cpp
File metadata and controls
75 lines (51 loc) · 1.7 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
using namespace std;
int c=56;
int main()
{
int a,b,c;
cin>>a;
cin>>b;
c=a+b;
cout<<c<<endl;
cout<<"global c is "<<::c;//scope resolution opertor using in global variable
return 0;
//************************************c++**************//
#include<iostream>
using namespace std;
int c = 45;
int main(){
//*************Build in Data types****************
int a, b, c;
cout<<"Enter the value of a:"<<endl;
cin>>a;
cout<<"Enter the value of b:"<<endl;
cin>>b;
c = a + b;
cout<<"The sum is "<<c<<endl;
cout<<"The global c is "<<::c;
// ************* Float, double and long double Literals****************
float d=34.4F;
long double e = 34.4L;
cout<<"The size of 34.4 is "<<sizeof(34.4)<<endl;
cout<<"The size of 34.4f is "<<sizeof(34.4f)<<endl;
cout<<"The size of 34.4F is "<<sizeof(34.4F)<<endl;
cout<<"The size of 34.4l is "<<sizeof(34.4l)<<endl;
cout<<"The size of 34.4L is "<<sizeof(34.4L)<<endl;
cout<<"The value of d is "<<d<<endl<<"The value of e is "<<e;
// *************Reference Variables****************
Rohan Das----> Monty -----> Rohu ------> Dangerous Code float x = 455 float & y = x cout<<x<<endl cout<<y<<e
// *************Typecasting****************
int a = 45;
float b = 45.46;
cout<<"The value of a is "<<(float)a<<endl;
cout<<"The value of a is "<<float(a)<<endl;
cout<<"The value of b is "<<(int)b<<endl;
cout<<"The value of b is "<<int(b)<<endl;
int c = int(b);
cout<<"The expression is "<<a + b<<endl;
cout<<"The expression is "<<a + int(b)<<endl;
cout<<"The expression is "<<a + (int)b<<endl;
return 0;
}
}