This document is a C++ reference sheet that summarizes key elements of the C++ language such as headers, data types, operators, comments, and control structures like if/else statements, loops, and switches. It provides the basic syntax for these elements in 1-3 lines with examples to serve as a quick reference guide for C++ concepts.
This document is a C++ reference sheet that summarizes key elements of the C++ language such as headers, data types, operators, comments, and control structures like if/else statements, loops, and switches. It provides the basic syntax for these elements in 1-3 lines with examples to serve as a quick reference guide for C++ concepts.
This document is a C++ reference sheet that summarizes key elements of the C++ language such as headers, data types, operators, comments, and control structures like if/else statements, loops, and switches. It provides the basic syntax for these elements in 1-3 lines with examples to serve as a quick reference guide for C++ concepts.
This document is a C++ reference sheet that summarizes key elements of the C++ language such as headers, data types, operators, comments, and control structures like if/else statements, loops, and switches. It provides the basic syntax for these elements in 1-3 lines with examples to serve as a quick reference guide for C++ concepts.
by vittochan (vittochan) via cheatography.com/26692/cs/36424/
Include Headers Pointers If Else
#include <headername> int *ptr; Pointer definition if (condition) {
#include <iostream> Several standard ptr = &var1; ptr set to address of var1 \\Do something stream objects } var2 = *ptr; set var2 to value of var1 if (condition) { #include <string> std::basic_string \\Do something class template Arithmetic Operators } else { #include <math> Behaves as if each +, - , *, / Addition, subtraction, multip‐ \\Do something name from <cmath> lication, division } is placed in global % Modulus (rest of division) if (condition) { namespace, except ++ Add 1 to variable \\Do something for names of (example: i++) } elsei f (condition) { mathematical \\Do something special functions -- Subtract 1 to variable } else { (example: i--) #include <fstream> std::basic_fstream, \\Do something std::basic_ifstream, +=, -=, *= , /= Add/subtract/multiply/divide } std::basic_ofstream a value from the variable condition must be a condition that return a class templates and (example: i+=2; is equal to boolean value true or false several typedefs i=i+2;)
#include <cctype> Behaves as if each Switch
name from <cctype> Relational Operators switch (variable) { is placed in global < Less than case constant1 : namespace <= Less or Equal than \\Do something > Greater than break; Namespace >= Greater or Equal than case constant2 : using namespace std; \\Do something == Equal than break; Data Types != Not Equal than default: int integer type (-32768 to 32767) \\Do something Logical Operators break; char single character type || OR } float Floating-point types (single && AND default is optional precision) ! NOT double Floating-point types (double precision) bool true or false void type with an empty set of values
Comments
//Single line /*Multiple lines*/
By vittochan (vittochan) Published 8th January, 2023. Sponsored by ApolloPad.com
cheatography.com/vittochan/ Last updated 8th January, 2023. Everyone has a novel in them. Finish Page 1 of 2. Yours! https://apollopad.com C++ References Sheet Cheat Sheet by vittochan (vittochan) via cheatography.com/26692/cs/36424/