

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Good cheat sheet about C++ Syntax
Typology: Cheat Sheet
1 / 3
This page cannot be seen from the preview
Don't miss anything!
Terms in <> are tokens which describe generically what goes in there. All other terms are literally themselves. EXAMPLE:
// comment /* another comment */
bool int float char long short string // types 'a' 124 -25.0 1.33e5 "hello" true // literal constants (values)
#include < <library_name> > // include file directive #include "stuff.h" // include header file directive
using namespace
enum
#define
const
<element_type>
<function_name> ( <actual_parameters> ); // call to void function
// call to (or use of) function which returns a value
{ // block -- can replace ANY statement
cout << fixed setprecision(2) endl // output stream related terms
cin >> // input stream related terms
ifstream
<stream_name>.open( char *
<sting_name>.c_str() // convert string object to char array
if ( <boolean_expression> ) // if statement
if ( <boolean_expression> ) // if-else statement
switch (
while ( <boolean_expression> ) // while loop
do { // do-while loop
for (
class <class_name> // class header (prototype) { public: <function_prototypes> protected: <function_prototypes> private: <function_prototypes> <data_attributes> };
<class_name>::<function_name> ( <parameter_list> ) // member function { // implementation
<object_name>.<function_name>(<actual_parameters>); // member function call