How can I print to the console in c++? I'm not sure how, and print("")
doesn't work like in python. help please! I am not sure what to try now.
Asked
Active
Viewed 285 times
-4

coolcoder22
- 11
- 1
-
3`I'm not sure how, and print("") doesn't work like in python.` Thats correct, C++ is not Python. A good C++ book should explain how to print to the console. – tkausl Apr 04 '19 at 01:40
-
2#include
int main() { std::cout << "Hello World" << std::endl; return 0; } – MFisherKDX Apr 04 '19 at 01:41 -
"I am not sure what to try now." - I would suggest [reading a good book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). – Jesper Juhl Apr 04 '19 at 01:52
-
As others mentioned, you probably want to read a good book. If nothing, at least a good tutorial on YouTube. This would probably be the first tutorial – Hemil Apr 04 '19 at 01:55
-
Literally the first tutorial on any site would show you this. Also, simply Googling "c++ print console" would give you millions of results. There is less than no research effort here. – Tas Apr 04 '19 at 02:00
2 Answers
1
If you include a library called iostream with #include at the beginning of your code.
This will allow you use something like cout << "Text Here";
Hope this helped!
0
Include <iosstream>
and print using cout << "Text Here";
Example:
#include <iostream>
...
cout << "Text Here";

Wiezalditzijn
- 443
- 3
- 17