-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSession3.cpp
More file actions
117 lines (92 loc) · 2.26 KB
/
Session3.cpp
File metadata and controls
117 lines (92 loc) · 2.26 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include<iostream>
using namespace std;
// cout and cin are called objects of outputstream and inputstream resp.
// cout object is used with << (Insertion) i.e. insert data on console !!
// cin object is used with >> (Extraction) i.e. extract data from console !!
int main(){
int isInternetConnected = 0;
int isGPSConnected = 1;
if(isInternetConnected){
cout<<"You can browse Internet !!\n";
if(isGPSConnected){
cout<<"You can Navigate with Maps !!\n";
}else{
cout<<"Please Connect to GPS and try Again !!\n";
}
}else{
cout<<"Please Connect to Internet and try Again !!\n";
}
if(isInternetConnected && isGPSConnected){
cout<<"You can browse Internet and access maps for navigation!!\n";
}else{
cout<<"Please Connect to GPS and Internet and try Again !!\n";
}
int a=0, b=0, c=0;
cout<<"Enter number a:";
cin>>a;
if(a>b){
if(a>c){
cout<<"a is greatest: "<<a<<"\n";
}else{
cout<<"c is greatest: "<<c<<"\n";
}
}else{
if(b>c){
cout<<"b is greatest: "<<b<<"\n";
}else{
cout<<"c is greatest: "<<c<<"\n";
}
}
// Assignment1 : Compatre 3 numbers wihout logical operators && by keeping all conditions in mind !!
int olaMicro = 1;
int olaMini = 2;
int olaBike = 3;
int olaShared = 4;
int olaAuto = 5;
int cabType = 0;
cout<<"Which cab Type you would like to book ??";
cin>>cabType;
// Ladder if/else
/*
if(cabType == 1){
cout<<"You booked OLA MICRO\n";
}else if(cabType == 2){
cout<<"You booked OLA MINI\n";
}else if(cabType == 3){
cout<<"You booked OLA BIKE\n";
}else if(cabType == 4){
cout<<"You booked OLA SHARED\n";
}else if(cabType == 5){
cout<<"You booked OLA AUTO\n";
}else{
cout<<"Select a Valid Cab Type First\n";
}
*/
switch(cabType){
case 1:
cout<<"You booked OLA MICRO\n";
break;
case 2:
cout<<"You booked OLA MINI\n";
break;
case 3:
cout<<"You booked OLA BIKE\n";
break;
case 4:
cout<<"You booked OLA SHARED\n";
break;
case 5:
cout<<"You booked OLA AUTO\n";
break;
default:
cout<<"Select a Valid Cab Type First\n";
break;
}
// Assignment2 : Input marks of subjects from User and provide scored CGPA !!
int age = 2;
if(age>18){
cout<<"You Can Vote\n";
}
cout<<"is age greater than 18: "<<(age>18)<<"\n";
return 0;
}