-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut7.cpp
More file actions
62 lines (48 loc) · 1.85 KB
/
tut7.cpp
File metadata and controls
62 lines (48 loc) · 1.85 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
// In this program we learn about the how we use global operator
#include <iostream>
using namespace std;
int c = 34;
int main()
{
// 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 the global value of c is: " << ::c;
/*:: this is used to call the global operator because c is
with local operator in program */
// How we pass double to float
// float d= 34.43;
// // 34.43f
// long double e= 34.43f ;
// cout<<"the value of d is "<<d<<endl<<"the value of e is: "<<e<<endl;
// // 34.43 is in the form of longdouble so is we want to convert into float use
// // this (34.43f)
// // In the same way you can convert double int float by (34.43l)
// cout<< "The size of 34.43 is: "<<sizeof(34.43)<<endl;
// cout<< "The size of 34.43f is: "<<sizeof(34.43f)<<endl;
// cout<< "The size of 34.43F is: "<<sizeof(34.43F)<<endl;
// cout<< "The size of 34.43l is: "<<sizeof(34.43l)<<endl;
// cout<< "The size of 34.43L is: "<<sizeof(34.43L);
// ************ Refrence Variable****************
// float x = 555 ;
// float & y = x ;
// cout<<x<<endl;
// cout<<y;
// ************ Type casting **************
// it change the type of variable or
// it change one data type to other data type
// int f = 34;
// float h = 34.43 ;
// cout<<"The value is "<<(float)f<<endl;
// cout<<"The value is "<<(int)h<<endl; // or you can write int(a)
// int c = int(h);
// cout<<c;
// cout<<"The sume of a and b is: "<<f+h<<endl;
// cout<<"The sume of a and b is: "<<f+int(h)<<endl;
// cout<<"The sume of a and b is: "<<f+(int)h<<endl;
// return 0 ;
}