-
Notifications
You must be signed in to change notification settings - Fork 0
/
conditionals.cpp
99 lines (68 loc) · 1.47 KB
/
conditionals.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// #include<iostream>
// using namespace std;
// int main() {
// int dogs = 6;
// if(dogs < 5){
// puts("There are 5 dogs");
// } else if(dogs == 6){
// puts("There are not 7 dogs");
// }
// else{
// puts("They are not dogs");
// }
// if(true){
// puts("There are not any dog");
// }
// //in cpp zero means false compiler not consider it
// return 0;
// }
//if else
// #include<iostream>
// using namespace std;
// int main(){
// int number;
// cout << "Enter rating number between 1 to 5:" << endl;
// cin >> number;
// if(number == 1){
// cout << "Our rating is low" << endl;
// }
// if(number == 2){
// cout << "Our rating is growing" << endl;
// }
// if(number == 3){
// cout << "Our rating is in up" << endl;
// }
// if(number == 4){
// cout << "Our rating is good" << endl;
// }
// if(number == 5){
// cout << "Our rating is excellent" << endl;
// }
// if(number > 5){
// cout << "Our rating is out" << endl;
// }
// else{
// cout << "Our rating is out2" << endl;
// }
// return 0;
// }
//switch statement
#include<iostream>
using namespace std;
int main(){
int rating = 7;
switch(rating){
case 1: puts("1 star rating");
break;
case 2: puts("2 star rating");
break;
case 3: puts("3 star rating");
break;
case 4: puts("4 star rating");
break;
case 5: puts("5 star rating");
break;
default: puts("All the rating are out");
break;
}
}