only cout gives error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

only cout gives error

i have to do std::cout << «Hello World!», if only do cout i get an error message

7th Dec 2018, 8:53 AM
Truls Vidnes
Truls Vidnes - avatar
2 Answers
+ 2
std::cout << «Hello World!» ---> std::cout << "Hello World!";
7th Dec 2018, 9:04 AM
Babak
Babak - avatar
+ 1
If you just want to cout without using std::, then you have to add using namespace std; after your includes. This is auto-generated in the code playground. However I recommend to use it without namespaces. They are sometimes an error source for larger projects, so it's best to not get too used to it...
7th Dec 2018, 9:16 AM
Matthias
Matthias - avatar