Hello, I am new to c++ and attempting the for command. This is my code


int main()
    for (int x=1; x<=10; x++)
       cout <<"Hello";    

but the error : undeclared identifier comes up for cout.
I have tried other commands such as cin but none of them works inside the brackets.( For{})
Please help thanks.

Try putting

using namespace std;

after your include statements.
Also I'd put

return 0;

before your last }

Nevermind i fixed it.
I forgot to put using namespace std; :(
Thanks for your help though.

Ok no problem. Please mark the thread solved if you have no other questions. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.