Thursday, February 14, 2019

C++ COMPILE & EXECUTE

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
  1. Code — writing the program
  2. Save — saving the program
  3. Compile — compiling via the terminal
  4. 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 a stands for "assembler" and the out stands for "output". 
  • -Single line comment can be done using //.
  • -Multi-line comment can be done using /* */.

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.

LEARN THE COMMAND LINE

 



No comments:

Post a Comment