-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathok3.txt
78 lines (78 loc) · 1.58 KB
/
ok3.txt
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
// This is real code (almost)
// a program that can do three things
// a: compare three numbers
// b: if you're allowed to drink
// c: exit (because you can't exit if you don't choose this)
string opcion = "";
float first;
float second;
float third;
int year;
for(;opcion!="c";) {
print("Choose an option\n");
print("a)less, great or equal\n");
print("b)Validate age\n");
print("c)Exit\n");
read(opcion);
if(opcion == "a") {
print("Three numbers to compare:\n");
read(first);
read(second);
read(third);
if (first==second) {
print("First == second\n");
}
elif (first>second) {
print("First > second\n");
}
elif (first<second) {
print("First < second\n");
}
elif (first==third) {
print("First == third\n");
}
elif (first>third) {
print("First > third\n");
}
elif (first<third) {
print("first < third\n");
}
elif (third==second) {
print("Second == third\n");
}
elif (third>second) {
print("third > second\n");
}
elif (third<second) {
print("second > third\n");
}
else {
print("idk");
}
}
elif(opcion == "b") {
print("Age to validate: \n");
read(year);
do {
if (year >= 0)
{
if (year < 18)
{
print("can't drink\n");
}
else {
print("can drink \n");
}
}
else {
print("you haven't been born\n");
}
} while (year < 0);
}
elif(opcion == "c") {
print("exiting!\n");
}
else {
print("please choose a correct option\n");
}
}