Online C++ compiler
Compile and run C++ online free, no sign-up: write a program, give it input on stdin and see the output, compiler errors and run time in one click.
How do I run C++ code online?
This is an online C++ compiler: write a program with int main(), put its input in the Input box and press Run. It is compiled on the server and run once, and you see what it printed, the compiler's errors with their line numbers, and the run time — free, with no sign-up.
How it works
- Write your program. Start from int main() and include the headers you use — <iostream>, <vector>, <algorithm>, <string>, <map> and the rest of the standard library are all there. using namespace std; saves the std:: prefixes in short programs.
- Give it input. cin >> x reads whitespace-separated values of any type; getline(cin, line) reads a whole line. After cin >> n the newline is still waiting, so call cin.ignore() before a getline. For large input, ios::sync_with_stdio(false); cin.tie(nullptr); makes cin much faster. Put every line the program reads in the Input box before you run it.
- Run it. Press Run or Ctrl+Enter. You get what the program printed, any compiler or runtime error, and how long it ran. The first run without an account asks a quick check that you are a person.
Who it is for
Anyone writing C++ who wants it run now: a student checking a lab program or an exam answer, someone on a machine where nothing can be installed, or a learner trying C++ before setting it up.