-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLecture2.cpp
More file actions
56 lines (40 loc) · 1.72 KB
/
Copy pathLecture2.cpp
File metadata and controls
56 lines (40 loc) · 1.72 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
//#include<iostream> // cout code is in <iostream>
//using namespace std; // cout is namespace of std.
//int main(){ // starting of the programme
//cout<<"Namaste duniya :-) "<<endl;
/*
(<<) - used for displaying the program
(endl & \n) - used for new line
(;) - used for ending the line
int a = 123; // int takes 4 bytes and 1 byte = 8 bits
cout<<a<<endl; // max = 2^32-1 , min = 0 for positive int
char ch = 'v'; // char takes 1 bytes and 1 byte = 8 bits
cout<<ch<<endl; // max = 2^8-1 , min = 0 for positive char
float f = 1.2;
cout<<f<<endl;
double d = 1.22;
cout<<d<<endl;
int size = sizeof(d);
cout<<size<<endl;
int a = 'a'; here a prints 97 as the ascii value of 'a' is 97
cout<<a<<endl;
char ch = 98; here ch prints b as the ascii value of 98 is b
cout<<ch<<endl;
char ch1 = 123456; as the big int value can store in memory of char so last bit value of char will print
cout<<ch1<<endl;
unsigned int a = -122; here only 122 will be printed as it is unsigned int
cout<<a<<endl;
int a = -122;
cout<<a<<endl;
int a = 2/5; here 0 will be printed becoz datatype of a is int & int/int = int
cout<<a<<endl;
int a = 2.0/5; here 0 will be printed becoz datatype of a is int & float/int = float
cout<<a<<endl;
int a = 3;
int b = 4;
bool first = (a==b);
cout<<first<<endl; here false(0) is printed
int a = 0; here 1 will print as ! changes 1->0 and 0->1
cout<<!a<<endl;
*/
//}