-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut1.cpp
56 lines (43 loc) · 1.59 KB
/
tut1.cpp
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
#include <iostream>
using namespace std;
// int c = 58;
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 of a and b is: "<<c<<endl;
// cout<<"The global c is: "<<::c<<endl;
//********Float, Double and Long Double Literals********
// float d = 3.14f;
// long double e = 3.14l;
// cout<<"The size of 3.14 is: "<<sizeof(3.14)<<endl;
// cout<<"The size of 3.14f is: "<<sizeof(3.14f)<<endl;
// cout<<"The size of 3.14F is: "<<sizeof(3.14F)<<endl;
// cout<<"The size of 3.14l is: "<<sizeof(3.14l)<<endl;
// cout<<"The size of 3.14L is: "<<sizeof(3.14L)<<endl;
// cout<<"The size of d is: "<<d<<endl<<"The size of e is: "<<e<<endl;
//********Reference Variables********
// here y is a refernce variable Pointing towards x
// float x = 455;
// float & y = x;
// cout<<x<<endl;
// cout<<y<<endl;
//********Typecasting********
//changing one variable type to another
// int a = 45;
// float b = 45.45;
// 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;
}