MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/bitmasking/tricks.cpp:9–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#define endl '\n'
8
9int main(){
10 int x;
11 cin>>x;
12 if(x&1){
13 cout<<"odd"<<endl;
14
15 }
16 else
17 cout<<"even"<<endl;
18 //multipling a number by two using left and right shift ops
19 cout<<(24<<1)<<endl;
20 //division by 2
21 cout<<(24>>1)<<endl;
22
23 //changing a uper case to lower case
24 char a;
25 cin>>a;
26 cout<<char(a|' ')<<endl;//basically we are set ing the 5th bit of the upper case char
27 //(1<<5) is 100000 which is 32 in decimal
28 //system which denotes ' '(space) in ascii value
29 //changing a lower case to uper case
30 char e;
31 cin>>e;
32 // ~(1<<) is basically the char '_' (underscore)
33 cout<<char(e&'_')<<endl;
34 return 0;
35}
36
37

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected