the book im learning from told me to write this code but when i do i get
error: 'endl' was not declared in this scope. on line 9
1 2 3 4 5 6 7 8 9 10 11
|
#include <iostream>
int main()
{
int x = 0;
int i;
for (i = 1; i <= 100; i++) {
x += i;
}
cout << x << endl;
return 0;
}
|
Last edited on
Type using namespace std;
in between main function and #include <iostream>. It automatically includes cout, cin, endl, etc.