-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut8.cpp
More file actions
43 lines (37 loc) · 881 Bytes
/
tut8.cpp
File metadata and controls
43 lines (37 loc) · 881 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
39
40
41
42
43
#include<iostream>
using namespace std;
int main(){
int age;
cout<<"tell me your age: ";
cin>>age;
//Selection control structure ---> If-else ladder
// if((age<18) && (age>0)){
// cout<<"You cannot come to my party"<<endl;
// }
// else if(age==18){
// cout<<"You can come if you are a hutiya"<<endl;
// }
// else if (age<1){
// cout<<"You are not born yet";
// }
// else{
// cout<<"You can come to the party";
// }
//Selection control structure ---> Switch-case
switch (age)
{
case 18:
cout<<"You are 18";
break;
case 22:
cout<<"You are 18";
break;
case 1:
cout<<"You are 18";
break;
default:
cout<<"No special cases found";
break;
}
return 0;
}