C++ COMPILE & EXECUTE
C++ is a compiled language. That means that to get a C++ program to run, you must first translate it from the human-readable form to something a machine can "understand." That translation is done by a program called a compiler.
What did I do
Code → Save → Compile → Execute
- Code — writing the program
- Save — saving the program
- Compile — compiling via the terminal
- Execute — executing via the terminal
Compile (编译) hello.cpp using the terminal.
g++ hello.cpp
Execute(执行): To execute the new machine code file, all you need to do is type
./
and the machine code file name in the terminal:
./a.out
The
Note: Codes in the terminal can not be erased once summitted, so if you made a mistake, you'll have to reset the whole thing.
a
stands for "assembler" and the out
stands for "output". - -Single line comment can be done using
//
. - -Multi-line comment can be done using
/*
*/
.
No comments:
Post a Comment