Basic Characters

基本符号: 不包含运算符和判断符/“basic”嘛:)

part of the C++ program code

Special Characters

Character

Name

Meaning

//

Double slash

Beginning of a comment

#

Pound sign

Beginning of preprocessor directive

<>

Open/close brackets

Enclose filename in #include

()

Open/close parentheses

Used when naming a function

{}

Open/close brace

Encloses a group of statement

""

Open/close quotation marks

Encloses string of character

;

Semicolon

End of a programming statement

输出与换行(cout, endl, \n)

cout << "Howdy!"; //Howdy

cout << "Howdy" << "Aggies!"; //Howdy Aggies!
cout << "Howdy Aggies!"; //Howdy Aggies!

cout << "Programming is" << endl; //Programming is \n fun!
cout << "fun!";

cout << "Programming is\n"; //Programming is \n fun!
cout << "fun!";

The #include Directive

  • Insert the contents of another file into the program

  • This is a preprocessor directive, not part of C++ language

  • #include lines not seen by the compiler

  • Do NOT place a semicolon at end of #include line

Last updated

Was this helpful?