-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq012.cpp
More file actions
38 lines (29 loc) · 938 Bytes
/
q012.cpp
File metadata and controls
38 lines (29 loc) · 938 Bytes
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
#include <iostream>
//bools custam 1 byte
//é bom para decisões
int main(){
bool red_light {false};
bool green_light{true};
if(red_light == true){
std::cout << "Stop!" << std::endl;
}else{
std::cout << "Go through!" << std::endl;
}
if(green_light){
std::cout << "The light is green!" << std::endl;
}else{
std::cout << "The light is NOT green!" << std::endl;
}
//sizeof()
std::cout << "sizeof(bool) : " << sizeof(bool) << std::endl;
//Printing out a bool
//1 -->> true
//0 -->> false
std::cout << std::endl; //espaço em branco no terminal
std::cout << "red_light : " << red_light << std::endl;
std::cout << "green_light : " << green_light << std::endl;
std::cout << std::boolalpha;
std::cout << "red_light : " << red_light << std::endl;
std::cout << "green_light : " << green_light << std::endl;
return 0;
}