I know to build a program you use code blocks, but how would you test something like
3+4;
I know it's going to be a 7, but how would you run it.
I tried notepad++, but it just gives me a new line.
Try this:
1 2 3 4 5 6 7 8 9 10
|
#include <iostream>
using namespace std;
int main() {
cout << 3 + 4 << endl; //Prints 3 + 4 to console
cin.get(); //Press enter to exit
return 0;
}
| |
To run it, compile it from your ide or use mingw32 if you're using notepad++ and type into the msys prompt:
g++ example.cpp -o example.exe -static-libgcc -static-libstdc++
Though, I recommend you just use an IDE, though seperate text editor and compiler can be fun.
Last edited on