Skip to main content
C++ Bug Hunt Easy +10 XP

Missing Include

This code won't compile. What's missing?

C++Find the bug
1int main() {
2 cout << "Hello" << endl;
3 return 0;
4}
The bug is on line 1

Select the correct fix

Show answer and explanation

Answer: Add #include <iostream> and using namespace std;

cout and endl are in the <iostream> header. You also need 'using namespace std;' or prefix with std::.

Hint: Where does cout come from?

What this challenge tests

Bug Hunt in C++: includes, basics.

Related challenges