How do I access command prompt from a C++ program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do I access command prompt from a C++ program?

I'd need to access command prompt in C++ runtime. Like in Python you can access command prompt by: from os import system system("echo Hello World")

22nd Jul 2020, 12:36 PM
Seb TheS
Seb TheS - avatar
3 Answers
+ 5
by using System: #include <iostream> using namespace std; int main() { system("echo 'hello world' "); return 0; }
22nd Jul 2020, 12:40 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 3
Bahha🐧 That easy!?
22nd Jul 2020, 12:41 PM
Seb TheS
Seb TheS - avatar
+ 2
yes, try it and see 😃
22nd Jul 2020, 12:43 PM
Bahhaⵣ
Bahhaⵣ - avatar