| Task: | Kortit |
| Sender: | boshijoshii |
| Submission time: | 2022-11-13 17:00:15 +0200 |
| Language: | C++ (C++17) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:9:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
9 | cout << "Please enter an integer value no greater than 52, enter 0 to exit the program";
| ^~~~
| std::cout
In file included from input/code.cpp:2:
/usr/include/c++/11/iostream:61:18: note: 'std::cout' declared here
61 | extern ostream cout; /// Linked to standard output
| ^~~~
input/code.cpp:10:17: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
10 | cin >> i;
| ^~~
| std::cin
In file included from input/code.cpp:2:
/usr/include/c++/11/iostream:60:18: note: 'std::cin' declared here
60 | extern istream cin; /// Linked to standard input
| ^~~Code
#include <iostream>
int main()
{
while (true) {
int i;
cout << "Please enter an integer value no greater than 52, enter 0 to exit the program";
cin >> i;
if (i == 0) {
break;
}
else if (i == 1)
{
cout << "no\n";
}
else if (i > 1 && i <= 26)
{
cout << "maybe\n";
}
else if (i > 26 && i <= 52)
{
cout << "yes\n";
}
else if (i > 52)
{
cout << "out of range\n";
}
}
return 0;
}