-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem4.c++
More file actions
38 lines (34 loc) · 763 Bytes
/
Problem4.c++
File metadata and controls
38 lines (34 loc) · 763 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
/*Write a program that asks the user to enter their details: age and
driver's license, then 'rented' if they are over 21 years old and have a
driver's license, otherwise print 'disapproved'*/
#include <iostream>
using namespace std;
struct stInfo
{
short Age;
bool HasDrivingLicense;
};
stInfo ReadInfo()
{
stInfo Info;
cout << "Pleas enter Your Age ?" << endl;
cin >> Info.Age;
cout << "Do you has driver License?" << endl;
cin >> Info.HasDrivingLicense;
return Info;
}
bool IsAccepted(stInfo Info)
{
return (Info.Age > 21 && Info.HasDrivingLicense);
}
void PrintResult(stInfo Info)
{
if (IsAccepted(Info))
cout << "\n Hired \n";
else
cout << "\n Rejected \n";
}
int main()
{
PrintResult(ReadInfo());
}