Recent Changes - Search:

Welcome to CAVI, the Cisco Academy for the Vision Impaired.

Course Fees Linux Wiki HTML Wiki Documentation Index PmWiki FAQ

Edit SideBar

Chapter1

Chapter 1

1.1.1

Image 1:

This image shows a group of 14 people with a speech bubble over their heads with C++ written inside the speech bubble.

1.1.2

Image 1:

This image is showing a desktop monitor with numbers and words beaming out of the monitor taking up the entire picture.

1.1.3

Image 1:

In the centre of the screen there is a large purple coloured rectangle with rounded corners, in the centre of the rectangle is the word compiler in bold white text. The source code or source file enters into the compiler from the top of the rectangle which changes it to machine language in ones and zeroes, which then exits from the bottom of the rectangle.

1.1.4

Image 1:

This image shows four books on C++, these are called: C++ Programing language, thinking in C++, Jumping into C++, and Effective C++ Third Edition.

1.2.1

Image 1:

This image shows a simple program which is written out below:

#include<iostream>
Using namespace std;
int main(void){
cout<< ”it’s me, your first program.”;
return 0;

1.2.2

Image 1

This image shows a simple program which is written out below:

#include<iostream>
Using namespace std;
int main(void){
cout<< ”it’s me, your first program.”;
return 0;
} 

1.2.3

Image 1:

This image shows a simple program which has been written out below:

#include<iostream>
Using namespace std;
int main(void){
cout<< ”it’s me, your first program.”;
return 0;
} 

1.2.4

Image 1:

This image shows a simple program which has been written out below:

#include<iostream>
Using namespace std;
int main(void){
cout<< ”it’s me, your first program.”;
return 0;
} 

1.2.5

Image 1:

This image shows a simple program which has been written out below:

#include<iostream>
Using namespace std;
int main(void){
cout<< ”it’s me, your first program.”;
return 0;
} 

1.2.6

Image 1:

This image shows a simple program which has been written out below:

#include<iostream>
Using namespace std;
int main(void){
cout<< ”it’s me, your first program.”;
return 0;
} 

1.3.1

Image 1:

This image shows whole numbers and fractional numbers continually racing around the screen.

1.3.2

Image 1:

This image shows various numbers stored in three separate trays.

1.3.3

Image 1:

This image shows various numbers stored in three separate trays with one of the trays highlighted.

1.3.4 Image 1:

This image shows the code for a variable. The written code is Int counter;

1.3.5

Image 1:

This image shows the code for the assignment operator. The written code is as follows: Counter=1;

1.3.6

Image 1:

This image shows the code for a variable and the assignment operator. The written code is as follows: Result=100+200;

1.3.7

Image 1:

This image shows the code for a variable and the assignment operator. The written code is as follows: X=X+1;

1.3.8

Image 1:

This image shows a list of reserved keywords for C++, the reserved keywords for C++ are written out below.

and, and_eq, asm, auto, bitand, bitor, bool, break, case, catch, char, class, compl, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long mutable, namespace, new, not, not_eq, operator, or, or_eq, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, votatile, wchar_t, while, xor, xor_eq

1.3.9

Image 1:

This image shows a male sitting with a laptop and mobile phone at a table.

1.3.10

Image 1:

This image shows the line comment command in the C++ code. This is written out below:

int Counter;// counts the number of sheep in the meadow 

1.3.11

Image 1:

This image shows the block comment command in the C++ code. This has been written out below.

/*Counter variable counts the number of sheep in the meadow*/
int Counter; 

1.3.12

Image 1:

This is an image of the block comment command in the C++ code which is written out below.

/******************************************************************************
Counting sheep version 1.0 
Author: Ronald sleepyhead, 2012 
Email: rs@isomnia.org 

Changes:
2012-09-13: Ginny Drowsy: counting black sheep improved
********************************************************************************/

1.3.13

Image 1:

This is an image of a block comment command and another block comment command in the same block comment command code in C++. The code has been written out below.

/*int i; /*int j;*/ int k; */ 

1.4.1

Image 1:

This image shows various decimal mathematical symbols.

1.4.2

Image 1:

This image shows the number two and a half with the point between the two numbers. This has been written out below in C++ code.

2.5  

1.4.3

Image 1

This image shows the number zero point four. This has been written out below in C++ code.

.4 

1.4.4

Image 1:

This image shows the number four and a point. This has been written out below in C++ code:

4. 

1.4.5

Image 1:

This image shows the speed of light and how fast it moves, this has been written out below. Speed of Light: 300000000 M/S

1.4.6

Image 1:

This image shows a large red coloured circle with 3 smaller coloured circles in yellow, orange and blue continuously rotating around the red circle.

1.4.7

Image 1:

This image shows how to declare floating-point variables in C++ code. This has been written out below.

Float pi, field; 

1.4.8

Image 1:

This image shows how to perform division for whole numbers and decimal numbers in C++ code. The code is written out below.

int i; 
float x; 
i=10/4;
x=10.0/4.0; 

1.4.9

Image 1:

This image shows how integer numbers are turned into float numbers in C++ code. This is written out below.

int i; 
float f; 
i=100;
f=i; 

1.4.10

Image 1:

This image shows how float numbers are turned into integer numbers in C++ code which has been written out below.

int i; 
float f; 
f=100.25; 
i=f;

1.4.11

Image 1:

This image shows the variable i which is too big of a number for the computer to assign a number to. This has been written out below.

int i; 
float f;
f=1E10; 
i=f; 

1.4.12

Image 1:

This image shows the different arithmetic operators that can be used. These have been written out below.

Arithmetic operators: plus, minus, slash, asterisk and percent sign.

1.4.13

Image1:

This image shows the multiplication operator being used in C++ code for both whole numbers and decimal numbers. The code is written out below.

int i,j,k;
float x,y,z;
i=10;
j=12;
k=i*j;
x=1.25;
y=0.5;
z=x*y; 

1.4.14

Image 1:

This image shows the divisional operator being used in C++ for both whole numbers and decimal numbers which have been written out below.

int i,j,k;
float x,y,z;
i=10; j=5;
k=i/j;
x=1.0; y=2.0;   
z=x/y; 

1.4.15

Image 1:

This image shows the divisional operator being used in C++ code to divide by zero. The code has been written out below.

 
float x; 
X=1.0/0.0; 

1.4.16

Image 1:

This image shows the divisional operator being used in the C++ code to divide by zero which gives an infinitive result. The code has been written out below.

float x,y; 
X=0.0
Y=1.0/x; 

1.4.17

Image 1:

This image shows the addition operator being used in the C++ code with whole numbers and decimal numbers. The code has been written out below.

int I,j,k;
float x,y,z;
i=100; j=2;
k=i+j; 
x=1.0; y=0.02;
z=x+y; 

1.4.18

Image 1:

This image shows the subtraction operator being used in C++ code with whole numbers and decimal numbers. The code has been written out below.

int i,j,k;
float x,y,z; 
i=100; j=200;
k=i-j;
x=1.0; y=1.0; 
z=x-y; 

1.4.19 Image 1:

This image shows the subtraction operator being used as a unary operator in C++ code with whole numbers. The code has been written out below.

int i,j;
i=-100;
j=-i; 

1.4.20

Image 1:

This image shows the plus operator being used as a unary operator in C++ code with whole numbers. The code has been written out below.

int i,j; 
i=100;
j=+I; 

1.4.21

Image 1:

This image shows the remainder operator which is the percent sign; this can only be used with whole numbers in C++ code. The code has been written out below.

int i,j,k;
i=13; 
j=5;
k=i%j;

1.4.22

Image 1:

This image shows a graphical mathematical expression which has been written out below.

2+3*5 

1.4.23

Image 1:

This image shows a graphical mathematical expression which is left side binding in C++ code. The expression is written out below.

2+3+5 

1.4.24

Image 1:

This image shows the basic operator priorities in C++ code. These have been written in the table below.

plus, minusunary
multiplication, division, percent signbinary

1.4.25

Image 1:

This image shows a graphical mathematical expression which has been written out below.

2*3%5 

1.4.26

Image 1:

This image shows the graphical mathematical expression result from 1.4.25 which is written out below.

2*3%5=1 

1.4.27

Image 1:

This shows a mathematical expression written in C++ code using parentheses and whole numbers. This has been written out below.

int i,j,k,l;
i=100;
j=25;
k=13;
i=(5*((j%k)+i)/(2*k))/2;

1.4.28

Image 1:

This image shows a the result of the mathematical expression from 1.4.27. this is written out below.

i=(5*((j%k)+i)/(2*k))/2=10

1.4.29

Image 1:

This image shows 5 fluffy woolly sheep on the screen.

1.4.30

Image 1:

This is an image of a calendar. A green pin has been placed on the first of March and a Red pin on the tenth of March.

1.4.31

Image 1:

This image shows two new operators for C++ code. These have been written out below.

++ The increment operator. 
-- The Decrement operator. 

1.4.32

Image 1:

This image shows the difference between the pre and post increment operator and the pre and post decrement operator. The differences have been written out below.

Variable++ (post increment operator) 
++Variable (pre increment operator)
Variable-- (post decrement operator)
--Variable(pre decrement operator)

1.4.33

Image 1:

This image shows the post operators used in C++ code. These are written out below.

int i,j;
i=1;
j=i++; 

1.4.34

Image 1:

This image shows the pre operators used in C++ code. These have been written out below.

int i,j;
i=1;
j=++i; 

1.4.35

Image 1:

This image shows the pre and post operators used, as well as whole numbers in the mathematical expression in the C++ code. These have been written out below.

int i,j; 
i=4;
j=2*i++;
i=2*--j; 

1.4.36

Image 1:

This image shows a table with the updated operator’s priorities in C++. The table has two columns, column one is the operators and column two indicates whether the operator is unary or binary. The table is written out below.

++--+-Unary
*/%
+-Binary
=

1.4.37

Image 1:

This image shows the shortcut operator used in C++ code. This is written out below.

i=i*2;

1.4.38

Image 1:

This is an image of the shortcut operator used in the C++ code which has been written out below.

Sheepcounter=sheepcounter+10;

1.4.39

Image 1:

This image is showing the shortcut operator used in the C++ code which is written out below.

i*=2;
Sheepcounter+=10;

1.4.40

Image 1:

This image shows a table of shortcut operators. The table has two columns, the first column is the full expression and column two is the shortcut expression. The table has been written out below.

i=i+2*j;i+=2*j;
Var=Var/2;Var/=2;
Rem=Rem%10;Rem%=10;
j=j-(i+Var+Rem);j-=(i+Var+Rem);

1.5.1

Image 1:

This image shows various letters, numbers and arithmetic signs, some examples are written out below.

XYZ, %, Underline k, %d and abcd 

1.5.2

Image 1:

This is an image of C++ code used to store and manipulate characters. This is written out below.

char character;

1.5.3

Image 3:

This image is showing the ASCII code table which has been written out below. The table has four sets of three columns next to each other. At the top of each set of three columns are the headings Character, Decimal (shortened to Dec) and Hexadecimal (shortened to Hex). Underneath each of the headings are the characters, decimal numbers and hexadecimal numbers. The table has been translated below.

CharacterDecimal ValueHexadecimal Value
(NUl)00
(SOH)11
(STX)22
(ETX)33
(EOT)44
(ENQ)55
(ACK)66
(BEL)77
(BS)88
(HT)99
(LF)100A
(VT)110B
(FF)120C
(CR)130D
(SO)140E
(SI)150F
(DLE)1610
(DC1)1711
(DC2)1812
(DC3)1913
(DC4)2014
(NAK)2115
(SYN)2216
(ETB)2317
(CAN)2418
(EM)2519
(SUB)261A
(ESC)271B
(FS)281C
(GS)291D
(RS)301E
(US)311F
(space)3220
!3321
3422
#3523
$3624
%3725
&3826
3927
(4028
)4129
*422A
+432B
,442C
-452D
.462E
/472F
04830
14931
25032
35133
45234
55335
65436
75537
85638
95739
:583A
;593B
<603C
=613D
>623E
?633F
@6440
A6541
B6642
C6743
D6844
E6945
F7046
G7147
H7248
I7349
J744A
K754B
L764C
M774D
N784E
O794F
P8050
Q8151
R8252
S8353
T8454
U8555
V8656
W8757
X8858
Y8959
Z905A
[915B
\925C
]935D
^945E
_955F
`9660
a9761
b9862
c9963
d10064
e10165
f10266
g10367
h10468
i10569
j1066A
k1076B
l1086C
m1096D
n1106E
o1116F
p11270
q11371
r11472
s11573
t11674
u11775
v11876
w11977
x12078
y12179
z1227A
{1237B
|1247C
}1257D
~1267E
 1277F

1.5.4

Image 1:

This image shows the 1st method to use Char to assign specific characters in C++, this is written out below.

Character=’A’;

1.5.5

Image 1:

This image shows another example of the 1st method to use Char to assign specific characters in C++, this is also written out below.

Character=’*’; 

1.5.6

Image 1:

This image shows the second method of using char to assign specific characters using the ASCII code in C++, this has been written out below.

Character=65; 

1.5.7

Image 1:

This image shows different whole numbers and decimal numbers, for example: 1.12, 100.00, 63, 13, 99, 3.14, 7, 8.

1.5.8

Image 1:

This is an image of char being used to identify the literal of backslash in the C++ code. This has been written out below. Character=’\’’;

1.5.9

Image 1:

This image shows char being used to escape from the backlash in C++ code. This is written out below.

Character=’//’; 

1.5.10

Image 1:

This image shows the C++ code transition to a new line. This has been written out below.

\n 

1.5.11

Image 1:

This image is showing C++ code return to the beginning of the line. This is written out below.

\r 

1.5.12

Image 1:

This image is showing a C++ code alarm. This has been written out below.

\a

1.5.13

Image 1:

This image shows the C++ code null which has been written out below.

\0 

1.5.14

Image 1:

This image shows char being used for an escape using the ASCII table in C++ code, which is written out below.

Character=’\47’; 

1.5.15

Image 1:

This image shows char being used for a second escape using the ASCII table in C++ code, which is also written out below.

Character=’\x27’; 

1.5.16

Image 1:

This image is showing a mathematical expression using the char type in C++ code which has been written out below.

char Char;
Char=’A’;
Char=Char+32; 
Char=Char-‘ ‘;  

1.5.17

Image 1:

This image shows a mathematical expression of char values as integer values in C++ these are written out below.

Char=’A’+32; 
Char=’A’+’ ‘;
Char=65+’ ‘;
Char=97-‘ ‘;
Char=’a’-32;
Char=’a’-‘ ‘; 

1.5.18

Image 1:

this image shows the mathematical expression of char values as integer values in C++. These are written out below using the ASCII table.

Char=’A’+32; 
Char=’A’+’ ‘;
Char=65+’ ‘;
Char=97-‘ ‘;
Char=’a’-32;
Char=’a’-‘ ‘; 

1.6.1

Image 1:

This image shows a question mark.

1.6.2

Image 1:

This image shows two equal signs next to each other.

1.6.3

Image 1:

This image shows a question being asked in C++: is X equal to Y? This is written out below.

2==2

1.6.4

Image 1:

This image shows a question being asked in C++: is X equal to Y? This is written out below.

1==2

1.6.5

Image 1:

This image shows a question being asked in C++: is X equal to Y? This has been written out below.

i==0

1.6.6

Image 1:

This image shows a question being asked in C++: is X equal to Y? This is written out below.

BlackSheepCounter==2*WhitesheepCounter

The other way to write out this code is: BlackSheepCounter==(2*WhiteSheepCounter)

1.6.7

Image 1:

This image shows a question being asked in C++: why is X not equal to Y? This has been written out below.

DaysUntilTheEndOfTheWorld != 0

1.6.8

Image 1:

This image shows a question being asked in C++: is X greater than Y? This is written out below.

BlackSheep>WhiteSheep 

1.6.9

Image 1:

This image shows a question being asked in C++: is X greater than or equal to Y? This has been written out below.

CentrigradesOutside>=0.0 

1.6.10

Image 1:

This image shows a question being asked in C++: is X less than (or equal to) Y? This is written out below.

CurrentVelocity<110
CurrentVelocity<=110 

1.6.11

Image 1:

This image shows how to store an answer which the computer has performed in C++ code. This has been written out below.

int Answer,Value1,Value2;
Answer=value1>=value2; 

1.6.12

Image 1:

This image shows the updated priority table which has been written out below.

++, --, +, -,unary
*, /, % 
+, -binary
<, <=, >, >= 
==, != 
=, +=, -=, *=, /=, %= 

1.6.13

Image 1:

This image shows a conditional instruction or conditional statement which has been written out below in C++ code.

if(true_or_not)do_this_if_true; 

1.6.14

Image 1:

This image shows another example of conditional instruction or conditional statement which has also been written out below in C++ code.

if(TheWheatherIsGood)GoForAWalk();
HaveLunch();

1.6.15

Image 1:

This image shows another example of conditional instruction or conditional statement which has also been written out below in C++ code.

If(SheepCounter >= 120)SleepAndDream(); 

1.6.16

Image 1:

This image shows another example of conditional instruction or conditional statement with a compound statement which is also written out below in C++ code.

If(SheepCounter >= 120){MakeABed(); TakeAShower(); SleepAndDream();} FeedTheSheepDogs();

1.6.17

Image 1:

This image shows an example of a conditional instruction or conditional statement with a compound statement which has also been written out below in C++ code.

If(SheepCounter >= 120){
MakeABed();
TakeAShower();
SleepAndDream();
}
FeedTheSheepDogs()

1.7.1

Image 1:

This image shows a C++ code program being displayed on the computer screen; the C++ code program is then turned into machine language which then exits the computer screen from the right side and out of the image.

1.7.2

Image 1:

This image shows an example of an output stream in C++ which has been written out below.

int herd_size=110; 
cout<<herd_size; 

1.7.3

Image 1:

This image shows another example of an output stream in C++ which is written out below.

int herd_size=123;
cout<<”Sheep counted so far: “<<herd_size;

1.7.4

Image 1:

This is an image of another example of an output stream in C++, this has also been written out below.

 
int square_side=12;
cout<<”The square perimeter is: “<<4*square_side;

1.7.5

Image 1:

This image shows another example of an output stream with a manipulator in C++, this is written out below.

int byte=255; 
cout<<”Byte in hex: “<<hex<<byte;

1.7.6

Image 1:

This image shows another example of an output stream with manipulators in C++, this is also written out below.

int byte=255; 
cout<<hex<<byte; 
cout<<byte<<dec<<byte;

1.7.7

Image 1:

This image shows an example of an output stream with a manipulator in C++, this has been written out below.

int byte=255;
cout<<oct<<byte; 

1.7.8

Image 1:

This image shows an example of an output stream with a setbase manipulator in C++, this is written out below.

#include<iostream>
#include<iomanip> 
Using namespace std; 
int main (void)
{
int byte=255; 
cout<<setbase(16)<<byte; 
return 0; 
}

1.7.9

Image 1:

This image is showing another example of an output stream in C++, which has been written out below.

char Char=’X’, Minus=’-‘;
float Float=2.5; 
cout<<Char<<Minus<<Float; 

1.7.10

Image 1:

This image shows another example of an output stream in C++ and is written out below.

char Char=’X’;
int Int=Char;
cout<<Char<<” “<<(int)Char<<” “<<Int<<” “<<(char)Int; 

1.7.11

Image 1:

This image shows an example of an output stream with an end manipulator in C++, this is written out below.

cout<<”1\n2”<<endl<<”3\n”; 

1.7.12

Image 1:

This image is showing another example of an output stream with fixed and scientific manipulators in C++, these are written out below.

float x=2.5, y=0.0000000025;
cout<<fixed<<x<<” “<<y<<endl;
cout<<scientific<<x<<” “<<y<<endl;

1.7.13

Image 1:

This image shows two hands in front of the earth which is coloured in blue and white typing on a keyboard.

1.7.14

Image 1:

This image shows an example of an input stream in C++ which has been written out below.

cin>>MaxSheep; 

1.7.15

Image1:

This image shows another example of an input stream in C++ which has been written out below.

#include<iostream>
Using namespace std; 
int main(void)
{ 
int value,square;
cout<<”Give me a number and I will square it!\n”;
cin>>value;
square=value*value;
cout<<”You’ve given ”<<value<<endl;
cout<<”The squared value is ”<<square<<endl;
return 0;
} 

1.7.16

Image 1:

This image shows an example of an input stream with square root float manipulator, working with float numbers known as decimal numbers in C++. This has been written out below.

#include<iostream>
#include<cmath> 
Using namespace std; 
int main(void){
float value, squareroot;
cout<<”Give me a number and I will find its square root: “<<endl; 
cin>>value;
if(value>=0.0){ 
squareroot=sqrtf(value);
cout<<”You Have given: “<<value<<endl;
cout<<”The square root is: “<<squareroot<<endl;
}
return 0;
} 
Edit - History - Print - Recent Changes - Search
Page last modified on August 23, 2017, at 07:06 PM