Skip to content

Commit 62ff051

Browse files
committed
Create c5.cpp
1 parent c93f161 commit 62ff051

File tree

1 file changed

+38
-0
lines changed
  • Nível 1 - Lógica/3 - Estrutura de Repetição/exercícios/soluções/marlonwq

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
int N, casal = 2, triplo = 3, familia = 5, quadruplo = 4;
6+
cin >> N;
7+
string input;
8+
9+
while (true) {
10+
cin >> input;
11+
12+
if (input == "FIM") {
13+
break;
14+
}
15+
16+
if (input == "Casal") {
17+
N -= casal;
18+
} else if (input == "Triplo") {
19+
N -= triplo;
20+
} else if (input == "Quadruplo") {
21+
N -= quadruplo;
22+
} else if (input == "Familia") {
23+
N -= familia;
24+
}
25+
26+
if (N <= 0) {
27+
break;
28+
}
29+
}
30+
31+
if (N <= 0) {
32+
cout << "Pode reservar! Esses quartos cabem todos." << endl;
33+
} else {
34+
cout << "Procure outra pousada." << endl;
35+
}
36+
37+
return 0;
38+
}

0 commit comments

Comments
 (0)