0

Where is the problem

Please don't yell at me #include <iostream> using namespace std; int main() { int x = 10; cin >> x << endl; if (x != 10) { cout << "No"; goto main; } if (x == 10) { cout << "yos"; } return 0; }

19th Dec 2017, 3:12 PM
Michał Mucha
4 Answers
+ 3
you can do that also this way: #include <iostream> using namespace std; int main() { start: int x = 10; cin >> x;. //i have removed endl if (x != 10) { cout << "No"; goto start; } if (x == 10) { cout << "yos"; } return 0; }
19th Dec 2017, 3:50 PM
Roabs
Roabs - avatar
+ 1
I fixed it by removing "<< endl" and replacing "goto main;" with "main();".
19th Dec 2017, 3:46 PM
Jonas Geiler
Jonas Geiler - avatar
+ 1
thank you very much
19th Dec 2017, 3:54 PM
Michał Mucha
0
c++
19th Dec 2017, 3:16 PM
Michał Mucha