Programming Amon
Programming Amon
Programming Amon
Reserved words:
\r return يرجع اول سطر ويكمل الي فالجملة والي انحذف ما يرجع
\\ backslash print \
Order:
all operation inside () evaluated first
+ - are in the same level they come last evaluated left to right
Type conversation:
Power = pow(x,2) 𝑥 2
control structures:
else if ()
second */%
third + -
fifth == !=
sixth &&
seventh ||
last =
1. Mode base-in
2. A - A ÷ b x b
is no longer true }
Syntax:
counter controlled while loop
int counter=0;
When do you know exactly how while ( counter<(limit-1) )
{
many iteration loops should
statement;
execute we called it counter control }
Syntax:
sentinel controlled while loop
int sentinel=-999;
we use it when we want to stop while (number!=sentinel)
{
at certain value
statement;
}
Syntax:
flag controlled while loop while ( !found )
{
use boolean variable to control
if( condition )
the loop (bool found=false) found=true;
}
#include <cmath>
21.1 21
21.1 22
#include<cctype>
toupper(a) = A
tolower(A) = a
srand( time ( 0 ) );
cout<<rand();
always gives you a different value
cout<<rand()%100
will give you random numbers from 0 to 99
cout<<rand()%100+1
will give you random numbers from 1 to 99
cout<<rand()%(max-min+1)+min
for certain period from min to max use this formula
268/10=26
#include <iomanip>
cout<<showpoint<<fixed<<setprecision(2); 3.14
ifstream read;
read.close();
Arrays
Array collection of fixed number of components having same
data type and there is one , two-dimensional array
use for loop , starting from index 0 till index ( size-1 ) and
initialize sum=0 and add array[ i ] to the sum inside the loop,
print the sum outside the loop.
to output the array in reverse order
use for loop, start from last index which is ( size-1 ) and the
update condition it decrement – inside the for loop output
the index value.
Int list[ 10 ]={ 8,5,12 } array size 10 and first 3 index are
initialized, and the rest are zero
8 5 12 0 0 0 0 0 0 0
Array1[ i ] = Array2[ i ]
“ A “ 2 memory cells
‘ A ‘ 1 memory cell
Char array[ 16 ]
Because string end with null the largest string letters allowed
is 15
Cout<<name
Two-dimensional array
Initialize 2d array :
use normal row col loop but at the end of the row loop used
endl so you can go to the next line then start a new row
pre-defined functions
Cout<<v1;
Cout<<*p1;
p1=p2
*p1=*p2
P1 is pointing the same
As where p2 is pointing
P[2]