#include <iostream>
using namespace std;
int main(){
cout << "Hello World" << endl;
return 0;
}
You can use one of the many online IDEs to run your programs directly from your browser.
However, I recommend having a compiler installed locally (I'll be using g++
) and getting familiar with an editor/IDE of your choice (I'll be using VSCode).
Typically I would keep the input in a file called in.txt
and the expected output in a file called out.txt
.
If the program is in filename.cpp
, then I will typically run the following commands from a terminal:
g++ filename.cpp -O2 -o run; ./run < in.txt > myout.txt; diff out.txt myout.txt
This has the effect of:
run
.in.txt.
myout.txt
.myout.txt
with out.txt
.When still fleshing out a solution we might just want to run the following:
g++ filename.cpp -O2 -o run; ./run < in.txt
This will have the effect of:
run
.in.txt
.