-
Notifications
You must be signed in to change notification settings - Fork 0
/
OOP_Prac06.cpp
84 lines (77 loc) · 1.49 KB
/
OOP_Prac06.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
#include <iostream>
#include <string>
using namespace std;
int main()
{
int age, income;
string city, vehicle;
cout << "Enter Your age : " << endl;
cin >> age;
cout << "Enter Your income : " << endl;
cin >> income;
cout << "Enter Your city : " << endl;
cin >> city;
cout << "Enter Your vehicle : " << endl;
cin >> vehicle;
try
{
if (age >= 18 && age <= 55)
{
cout << "Your age is : " << age << endl;
}
else
{
throw age;
}
}
catch (int)
{
cout << "Your age is not accepted" << endl;
}
try
{
if (income >= 50000 && income <= 100000)
{
cout << "Your Income is : " << income << endl;
}
else
{
throw income;
}
}
catch (int)
{
cout << "Your Income is not acceptable " << endl;
}
try
{
if (city == "pune" || city == "mumbai" || city == "banglore" || city == "chennai")
{
cout << "You Live in : " << city << endl;
}
else
{
throw city;
}
}
catch (string)
{
cout << "Your city is not accepted" << endl;
}
try
{
if (vehicle == "4wheeler")
{
cout << "Nice" << endl;
}
else
{
throw vehicle;
}
}
catch (string)
{
cout << "Your vehicle is not accepted" << endl;
}
return 0;
}