Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

9/22/2016

eConcordia -Fundamentals of Object-Oriented Programming- Resource Centre

Print
SymbolsandOperators|SyntaxandCommands

SymbolsandOperators
Symbol

Name

::

Scopeoperator

Memberselectionoperator

++

Preorpostincrement

Preorpostdecrement

Logicalnot

Additionorunaryplus

Subtractionorunaryminus

Multiplication

http://www.econcordia.com/courses/fundamentals_oop/home/cheat_sheet.aspx

1/6

9/22/2016

eConcordia -Fundamentals of Object-Oriented Programming- Resource Centre

Division

Modulus

>

Greaterthan(relationaloperator)

>=

Greaterthanorequal(relationaloperator)

<

Lessthan(relationaloperator)

<=

Lessthanorequal(relationaloperator)

==

Equalto(relationaloperator)

!=

Notequalto(relationaloperator)

&&

And(logicaloperator)

||

Or(logicaloperator)

Assignmentoperator

+=

Addandassign

http://www.econcordia.com/courses/fundamentals_oop/home/cheat_sheet.aspx

2/6

9/22/2016

eConcordia -Fundamentals of Object-Oriented Programming- Resource Centre

Subtractandassign

*=

Multiplyandassign

/=

Divideandassign

%=

Modulusandassign

[..]

Subscript(usedwitharrays)

{..}

Marksstartandendofablock(compound
statement)

Markstheendofastatement

<<

Insertionoperator(usedwithcoutandoutputstream
variable)

>>

Extractionoperator(usedwithcinandinputstreamvariable)

//

/*..*/

Commentextendstotheendoftheline

Startandendofacommentwhichcanbe
morethanonelinelong

SyntaxandCommands
http://www.econcordia.com/courses/fundamentals_oop/home/cheat_sheet.aspx

3/6

9/22/2016

eConcordia -Fundamentals of Object-Oriented Programming- Resource Centre

ThefollowingisthesyntaxofthemainC++commandsseeninthiscourse.
Note:Thislistisnotcompleteandyoushouldrefertoyournotesand/ortextbookforallpossiblecasesforeachcommand.

Command/Statement

Syntax

Expression

Arrangementofidentifiers,literalsandoperatorsthat
canbeevaluatedtocomputeavalueofagiventype.

Assignment

Identifier=expression

Argumentlist

expression,expression,

Outputstatement

cout<<expression<<expression<<

Declaration

Typevariable,variable,...

Inputstatement

cin>>expression>>expression>>...

.get()

cin.get(variablename)

.getline(..,)

getline(cin,variable)

#include

#include<libraryname>or
#includeheaderfilename

.open()

Input/outputstreamvariable.open(filename)

http://www.econcordia.com/courses/fundamentals_oop/home/cheat_sheet.aspx

4/6

9/22/2016

eConcordia -Fundamentals of Object-Oriented Programming- Resource Centre

.close()

Input/outputstreamvariable.close()

if

if(logicalexpression)
statement

if(blocked)

if(logicalexpression)
{
statementA
statementB
...
}

if.else

if(logicalexpression)
statementA
else
statementB

while

while(logicalexpression)
statement

while(blocked)

while(logicalexpression)
{
statementA
statementB
...
}

switch

switch(expression)
{
caseconstantExpression:statement
...
default:statement
}

dowhile
http://www.econcordia.com/courses/fundamentals_oop/home/cheat_sheet.aspx

5/6

9/22/2016

eConcordia -Fundamentals of Object-Oriented Programming- Resource Centre

do
statement
while(logicalexpression)

dowhile(blocked)

do
{
statementA
statementB
...
}while(logicalexpression)

for

for(initStatementexpression1expression2)
statement

for(blocked)

for(initStatementexpression1expression2)
{
statementA
statementB
...
}

break

break

continue

continue

http://www.econcordia.com/courses/fundamentals_oop/home/cheat_sheet.aspx

6/6

You might also like