C++ General Flashcards
What are the 6 types of Operations in c++?
- Definition
- Arithmetic
- Assignment
- Logical
- Relational
- bitwise
- Miscellaneous
What are the 8 Punctuators in C++ ?
- // (Double Slash)
- # (Pound Sign)
- < > (Open/Close Brackets)
- ( ) (Open/Close Parenthesis)
- { } (Open/Close Brace)
- ” “ (Open/Close Quotation Marks)
- ; (Semicolon)
- : (Colon)
Explain the Double Slash ( // )
The double slash means the beginning of a comment
// Coding is Challenging
- (The compiler will ignore anything after the double slash)
Explain Open/Close Brackets ( < > )
Include<…>
Encloses File name in #Include
Explain the Pound Sign ( # )
Include
The pound sign ( # ) means the beginning of a preprocessor directive
- Directs the preprocessor to include the file called “Iostream” during the compilling process
- “Iostream” is also known as the header file
What are the parts of a C++ Program
- Comment
- Preprocessor Directive
- Which Namespace to use
- Begin a Function (main) with open/closed brace
- Output Statement
- Send 0, to operating system
Explain “Comment”
- Comment uses “//” (Slashes)
- Marks the beginning of a comment
- The compiler ignores everything from the Slashes to the end of the line
Explain Preprocessor directive
Explain cout
cout displays output on the computer screen
What is the sytax of “cout”
- Example
- Declare cout (Declare you want to display output)
- Use two open brackets << to send the output
- Use parenthesis and write what you want to send betweem them
- Separate more than one item with more brackets
- Use a semicolon to mark the end of the statement
- cout << “Coding is stressful” ;
Explain “endl”
endl starts a new line of output
What is the syntax of “endl”
- Begin with two open braces
- Write it before the end of the output code
- Punctuate with a semicolon to mark the end of the statement
cout << “Coding is stressfull” << endl;
return 0;
Explain “/n”
The escape sequence “/n” starts a new line of output
What is the syntax of /n
- Declare the escape sequence within the end of the output string
cout << “Coding is stressfull /n” ;
return 0;