You are on page 1of 41

Turbo C++

FOR DOS

FOR DOS

Turbo C++ Language

2......................................................................................................................................................................................................................................
3.......................................................................................................................................................................................................................................
4......................................................................................................................................................................................................... ++
5..................................................................................................................................................................................................................
5......................................................................................................................................................................................................
6 ..........................................................................................................................................................................................................................
7..............................................................................................................................................................................................................
8 ...................................................................................................................................................................................................................
9..........................................................................................................................................................................................................................
11...............................................................................................................................................................................................................
13 .......................................................................................................................................................................................
14 ........................................................................................................................................................................................................................
( 14............................................................................................................................................................................................................... ) For
17............................................................................................................................................................................................................................ While
19................................................................................................................................................................................................................... Do_While
21 ...............................................................................................................................................................................................
( 23............................................................................................................................................................................................................ ) IF
( ) IF 24 ..................................................................................................................................................................
28...................................................................................................................................................................................................................Functions
33................................................................................................................................................................................................................
38.......................................................................................................................................................................................................................

Turbo C++ Language

Turbo C++ is one of important programming language in the world , C++ language having many
versions which it is apply with the programs and applications of the computer system , and the most
important version between them is the version that microsoft company build the group of microsoft office
by using it , this version is called ( visual C++ ) , we here will exploring the first version of C++ that is
called ( Turbo C++ For Dos ) this type of this language will be your way to be a programmer in the future
so in this book will explain the basics of ( turbo C++ for Dos ) .
* first part own the agency functions this functions make turbo C++ very easier than the other programming
language .
* second part own the loop repetition and the instruction of it , after that we exploring the one dimension
matrixes and how we can edit it and how we can process it in turbo C++ .
* Third part own some lectures of the college for year .
here I'll leave you to discover all the subjects and I hope this book will back to you with a better primary
information about this huge programmer language and make you to take a step foreword .

X-PC Seven

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

C ++
>> << The Character Of Turbo C++

+
-+ +
-/

%
*
=!
==
||
&&
!

OR
AND
NOT

[]

Matrix

>
<

=>
=<



()1

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language


Variables Advert


( ) Compiler


, ,
( ) int , float , char , string (
) .
( ) int
( ) float
( ) 2


( ) ( ) 7 ( ) 100 , ( 2.3 ) Ex ..... 7.2

Integer
int
Real
Float
Character
Char


( 0.5 7.2345 ) Ex ...... 6.5678

( ) A B C D .... Ex ( ) a b c d ..... Ex ( @ . & . % . # . ) * . ! .
( . ) Char

()2

++
( ) } , Begin ,

.

>#include<iostream.h
) (main
{
; [i , j , a]10
int
; [i , j , a]10
char
; [i , j , a]10
float
.
.
.
}

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

-:
( . ) ++

( ) Compiler ++ Compiler , Compiler
, -:

>1- #include<iostream.h
>2- #include<math.h
>3- #include<conio.h
>4- #include<stdio.h
# .. < >

>#include<iostream.h

( ) # ( ) compiler .
: include . include
: iostream.h ( ) io ( ) input \ output ( ) stream ( ) io ( ) h
. headers
( < > )

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

>#include<iostream.h

. -

,
, -:

>> Cin
<<Cout

.
.

* ( ) 1

) * Example ( 1
>#include<iostream.h
) (main
{
; int x , y , z
; Cin>> x
; Cin>> y
;z=x+y
; Cout<< z
}

>#include<iostream.h
) (main
{
; int x , y , z
; Cin>> x >> y
;z=x+y
; Cout<< z
}


( ) ( ) main
++ ( ) Turbo Bascal ( } )
.

( ) Compiler ( ) X , Y , Z
( ) Int

( << ) Cin ( ( ) 1 <<
) Cin ( ) 1 .
( )
( ) X ( ) Y ,
( ) Z ( ) Z
( . ) z=x+y
( ) Z
( >> ) Cout ( ) Z .
++ ( { ) .
* -: Note

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

The Explaining Phrase

: .



( ) Insert Two Number To Multiply Them ,

( . ) 2

) * Example ( 2

* ( ) 2

>#include<iostream.h
) (main
{
; ''Cout<<'' Welcome In Turbo C++
}
) * Example ( 3

* ( ) 3

>#include<iostream.h
) (main
{
; int i
; '' Cout<<'' Insert A Number To Print It
; Cin>> i
; Cout<< i
}
( ) 3

.
* -: Note ++ ( ) 2

( '' '' << ) Cin
( ) Ctrl F5 .

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

>#include<math.h

( ) 3
.
( ) Compiler
.

S = Sin X

; ) S = Sin ( X

S = Cos X

; ) S = Cos ( X

S = Tan X

; ) S = Tan ( X
; ) S = Pow ( X , Y
()3

Power Instruction

( ) 3 ( ) X ( ) Y
( . ) S
( ) Power .. ( ) 4
( ) Y ( ) 2 ( ) X ( ) 2
( ) S ( ) 16

) * Example ( 4

* ( ) 4

>#include<iostream.h
>#include<math.h
) (main
{
; int s , x
; Cin>> x
; ) s = pow( x , 2 ) + pow( x , 2 ) + pow( x , 2 ) + pow( x , 2
; Cout<< s
}

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

( ) pow ( ) X
( ) 2 ( ) X ( ) X
( ) pow
( ) S ( ) S
( >> ) Cout ( ) S ( ) 5
.

) * Example ( 5

* ( ) 5

>#include<iostream.h
>#include<math.h
) (main
{
; int s , x
; Cin>> x
; ) s = pow( x , 3 ) + pow( x , 4 ) * pow( x , 2 ) + pow( x , 6
; Cout<< s
}
! .
-:

) * Example ( 6

* ( ) 6

>#include<iostream.h
>#include<math.h
) (main
{
; int s , x , i
; '' Cout<<'' Insert The Asas
; Cin>> x
; '' Cout<<'' Insert The As
; Cin>> i
; ) s = pow( x , i ) + pow( x , i ) + pow( x , i ) + pow( x , i
; Cout<< s
}


( ) X ( ) i
( ) Insert The Asas ( ) X ( ) Enter ( ) Insert The As ( ) i
( ) Enter ( Ctrl F5 .

* -: Note .

10

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

>#include<conio.h


( ) ( ) conio.h
( ( ) ) Clrscr ( . ) 7

) * Example ( 7

* ( ) 7

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; '' Cout << '' Turbo C++ Clear Screen Instruction
}
( ) conio.h ( ( ) ) Clrscr ( Turbo
) C++ Clear Screen Instruction
..
,
.

) * Example ( 8

* ( ) 8

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; int x , y , z
; Cin>> x >> y
;z=x*y
; Cout<< z
}
( ) 8

.

* -: Note
.

11

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

( ) 4 ( ) 4
. ( ) 9 .

) * Example ( 9

* ( ) 9

>#include<iostream.h
>#include<math.h
>#include<coino.h
) (main
{
; ) ( Clrscr
; int X , S
; '' Cout<<'' Enter The One Value
; Cin>> X
; ) S = Pow( X , 2 ) + Pow( X , 2 ) + Pow( X , 2 ) + Pow( X , 2
; Cout<< '' S '' << '' = '' << S
}
* ( ) 2 ...

S = 16

12

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

>#include<stdio.h

( ) HDD ( ) doc . txt . exe



-:

fopen

( . ) HDD

fclose

putc

( . ) Char

getc
fseek

( . ) Char
.

fprintf

.
( ) 4

) * Example ( --

* ( ) --

>#include<iostream.h
>#include<stdio.h
) ( main
{
; ] Char x [ 10
; int i
; FILE * q
; ) '' q = fopen ( '' w . dat '' , '' w
) for ( i = 0 ; i <=10 ; i ++
{
; Cin >> x
; ) fprintf ( q , x
}
; ) fclose ( q
}

13

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

... ...

... The Loop Repetition ...


- ( ) For

1st - The Loop Repetition - For

-: ++ ( ) For
.
( ) Loop
++ ( ) For .
: ( ) For ( ) Cin
.
) for ( Var = 1st Value ; Var <= Last Value ; Increment Magnitude ) Ex \ for ( i=0 ; i <=10 ; i ++
) for ( Var = 1st Value ; Var >= Last Value ; Increment Magnitude ) Ex \ for ( i=10 ; i >=0 ; i - -
* -: Note
( ) ... .
= 1 - Var
- = 2 - first value
- = 3 - Last value
= 4 - Increment Magnitude

- 1 : . - 2 : , 7 . - 3 : . - 4 - : , ( ) 10

) * Example ( 10

* ( ) 10

>#include<iostream.h
>#include<conio.h
) (main
{
; int i
; ) ( Clrscr
) for ( i = 0 ; i <= 10 ; i ++
; Cout<< '' '' << i
}
0 9 ( ) Cin ,
( ) i++ .

0123456789

14

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

( ) 10 ( ) For ( ) 10

) * Example ( 11

* ( ) 11

>#include<iostream.h
>#include<conio.h
) (main
{
; int i
; ) ( Clrscr
) for ( i = 10 ; i >= 0 ; i --
; Cout<< '' '' << i
}
10 0
( ) i-- .

10 9 8 7 6 5 4 3 2 1 0
( ) For

) for ( i = 10 ; i >= 0 ; i - = 1
( -: ) For
0 10

) for ( i = 0 ; i <= 10 ; i+=2

1 10

) for ( i = 1 ; i <= 10 ; i+=2


) for ( i = 9 ; i >= 0 ; i-=2

9 1 .

* : Notes
-1 2
2 .
-2
.
-3 .
-4 ( ) 9 ,
( ) 1 ( . ) 12

15

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

) * Example ( 12

* ( ) 12

>#include<iostream.h
>#include<conio.h
) (main
{
; int i
; ) ( Clrscr
) for ( i = 17 ; i >= 0 ; i - = 2
; Cout<< '' '' << i
}
17 15 13 11 9 7 5 3 1
1
.

\ 7 .

* ( ) 13
7
14
21
28
35
42
49
56
63
70

) * Example ( 13
>#include<iostream.h
>#include<conio.h
) (main
{
; int i
; ) ( Clrscr
; '' Cout << '' Multiplied Of Number Seven
) for ( i = 7 ; i <= 70 ; i + = 7
; Cout<< '' '' << i << endl
}

( ) 13 ( ) endl
.
* -: Note ( . ) Loop

16

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

- ( ) While

2nd - The Loop Repetition - While

: While ( ) For
( . ) 14

) * Example ( 14

* ( ) 14

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; int i = 0
) While ( i <= 9
{
; i ++
; Cout<< '' '' << i
}
}
1 10 9
( ) i++ .

1 2 3 4 5 6 7 8 9 10

The Global Base


) While ( Variable .. < .. > .. == .. <= .. >= .. != .. ! .. Last Value
{
; Variable ++ .. --
; any value that you want to repeat it
}

( ) While ..
: ( ) 14 1 10 ( ) Loop
( ) i ( ) ( ) Last Value
... -- , ++ variable

* -: Note ( ) 14
( ) i ( ) x

; '' Cout<< '' X

17

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

. ) While ( ) Loop (

* Example ( 15 )

) 15 ( *

#include<iostream.h>
#include<conio.h>
main( )
{
Clrscr ( ) ;
int i = 11 ;
While ( i >= 1 )
{
i -- ;
Cout<< '' '' << i ;
}

}
10 9 8 7 6 5 4 3 2 1 0
. ) While ( ) Loop (

* Example ( 16 )

) 16 ( *

#include<iostream.h>
#include<conio.h>
main( )
{
Clrscr ( ) ;
int i = 11 ;
While ( i >= 1 )
{
i-=1;

Cout<< '' '' << i ;
}


}
10 9 8 7 6 5 4 3 2 1 0

X-PC Seven : : xcxcomputer@yahoo.com : :

18

Turbo C++ Language

- ( ) Do_While

3rd - The Loop Repetition - Do_While

: Do While ( ) While ..
:

Do
{
; variable + = 1
Or
; variable - = 1
; any value that you want to repeat it
}
; ) while ( variable .. < .. > .. == .. <= .. >= .. != .. ! .. Last Value
}
) * Example ( 17

* ( ) 17

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; int i = 0
Do
{
;i+=1
; '' '' << Cout<< i
}
; ) While ( i <= 10
}
1 10 9
( ) i++ ( ) i+=1 .

1 2 3 4 5 6 7 8 9 10 11
( ) 17
: ( ) endl .

; Cout<< i << '' '' << endl

19

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

. ) Do_While ( \

* Example ( 18 )

) 18 ( *

#include<iostream.h>
#include<conio.h>
main( )
{
Clrscr ( ) ;
int i = 0 ;
Do
{
i+=2;
Cout<< i << '' '' << endl ;
}
While ( i <= 10 ) ;
}

X-PC Seven : : xcxcomputer@yahoo.com : :

20

Turbo C++ Language


...
...

... The One Dimension Matrixes ...




( ) Cin .
:
( [ ] ) a ( ) a
.
( ) 20 ( ) 19
:

) * Example ( 19

* ( ) 19

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; ] int i , a[ 5
) for ( i = 0 ; i <= 5 ; i + = 1
; ] Cin >> a[ i
; '' '' << ] Cout<< a[ i
}
) * Example ( 20

* ( ) 20

>#include<iostream.h
>#include<conio.h
) (main
{
; int i , j , k , l , m
; ) ( Clrscr
; Cin>> i
; Cin>> j
; Cin>> k
; Cin>> l
; Cin>> m
; Cout<< i << j << k << l << m
}
( ) 19 ( ) For ( ) i
( ) i++ ( ) Cout
( ) Cout ( Loop
) .

21

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language


Deal With The Matrix That Values Given Already

( ) 19
,
( . ) 21

} a [ 10 ] = { X , X , X , X , X , X , X , X , X , X
\ .

) * Example ( 21

* ( ) 21

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; } int i , a [ 5 ] = { 20 , 30 , 10 , 40 , 50
) for ( i = 0 ; i <= 5 ; i + = 1
; '' '' << ] Cout<< a[ i
}
20 30 10 40 50
* ( . ) 26

22

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

...

( ... ) if

... The Condition Phrase ( IF ) ...


:
,
( .. ) IF
) IF ( variable 1 < , > , == , >= , <= , % , != .... variable 2
; 1st Way
Else
; 2nd Way
( ) Variable 2
..
( : ) 22

* ( ) 22

) * Example ( 22
>#include<iostream.h
>#include<conio.h
) ( main
{
; Int i , z
; ) ( Clrscr
; Cin >> i >> z
) if ( i > z
; '' Cout<< i <<'' Is Large Number
) if ( i < z
; '' Cout<< i <<'' Is Small Number
) if ( i == z
; Cout<< '' There Is No Difference Between Them '' << i << '' = '' << z
}

( ) 7 and 3 :

7 Is Large Number
( ) 4 and 17 :

4 Is Small Number
( ) 17 and 17 :

There Is No Difference Between Them 17 = 17


* -: Note ( 3 ) 7 7 ( ) i ( ) i ( ) z
( ) Cin ( ) i ( . ) z

23

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

( ) IF
Examples About The Relation Between (IF) And Loop Repetition .

\ 10 ( . ) For

* ( ) 23

)(1
)(2
)(3
)(4
)(5
)(6
)(7
)(8
)(9
) ( 10

) * Example ( 23
>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; int i
) for ( i = 0 ; i <= 10 ; i ++
) if ( i % 2 == 0
; Cout << i
}

* ( ) 1 .
* ( ) 2 ( ) Clrscr .
* ( ) 3 .
* ( ) 4 .
* ( ) 5 .
* ( ) 6 .
* ( ) 7 ( ) 10 .
* ( ) 8 ( ) 10
( ) 2 ( ) ( ) %
( ) 2 ( . ) 2
* ( ) 9 .
* ( ) 10 .
\ 10 ( . ) For

* ( ) 24

)(1
)(2
)(3
)(4
)(5
)(6
)(7
)(8
)(9
) ( 10

) * Example ( 24
>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; int i
) for ( i = 0 ; i <= 10 ; i ++
) if ( i % 2 != 0
; Cout << i
}

24

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

* ( ) 1 .
* ( ) 2 ( ) Clrscr .
* ( ) 3 .
* ( ) 4 .
* ( ) 5 .
* ( ) 6 .
* ( ) 7 ( ) 10 .
* ( ) 8 ( ) 10
( ) 2 ( ) ( =! )
( ) 2 .
* ( ) 9 .
* ( ) 10 .
\ N ( . ) Do-While

) * Example ( 25

* ( ) 25

)(1
)(2
)(3
)(4
)(5
)(6
)(7
)(8
)(9
) ( 10
) ( 11
) ( 12
) ( 13
) ( 14

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; ] int i = 0 , a[ 10
Do
{
; ] Cin>>a[ i
) IF ( a[ i ] % 2==0
; Cout<<a [ i ] << '' '' << endl
}
; ) While ( i < 10
}

* ( ) 1 .
* ( ) 2 ( ) Clrscr .
* ( ) 3 .
* ( ) 4 .
* ( ) 5 .
* ( ) 6 .
* ( ) 7 .
* ( ) 8 ( ) While ( . ) 13
* ( ) 9 .
* ( ) 10 : ( ) 2 . ....
* ( ) 11 ( ) 2 .
* ( ) 12 .
* ( ) 13 : .
* ( ) 14 .
* ::

? Examination :: In Last Program If You Want To Print Odd Numbers What You Will Change In It

25

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language


\
( && ) ( ) 50 200 :

) * Example ( 26

* ( ) 26

>#include<iostream.h
>#include<conio.h
) (main
{
; ) ( Clrscr
; } int i , a [ 10 ] = { 111 , 40 , 177 , 100 , 199 , 30 , 70 , 50 , 20 , 10
) for ( i = 0 ; i <= 10 ; i + = 1
) ) IF ( ( a[ i ] >=50 ) && ( a[ i ] <=200
; '' '' << ] Cout<< a[ i
}
( && )
* -: Note ( && )
( . ) IF
:: ( ) 26 .
* 30 . 100
* .
* ( ) Loop .
* . { } .
* !! .
\ .

) * Example ( 27

* ( ) 27

>#include<iostream.h
>#include<conio.h
) (main
{
; ) (Clrscr
; int i , j=0 , x
; Cin>> x
) For ( i = 1 ; i <= x ; i++
) IF ( x % i == 0
; ++ j
)IF ( j<=2
; '' Cout<< x << '' Is Prime Number
Else
; '' Cout<< x << '' Is Not Prime Number
}

26

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

(
( : ) 27
)
( ) x ( ) i , .
: ( ) 7
< .. ) > x .
( ) 1 (
: ( ) 7 6 5 4 3 2 1 ( ) 7
( ) 7 ( ) 7
( ) j .. ..
: ( ) j ( ) 2
( ) j
.. .

27

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

... ...
... Functions ...
: Function ( )
.
:
- 1 .
- 2 .
- 3 .
- 4 .
- 5 .

The Global Base


>#include<iostream.h
; int , float , char , string variables
) ( Function Name
{
the instructions of function
}
) (main
{
; ) ( Function Name
}

)(1
)(2
)(3
)(4
)(5
)(6
)(7

* ( ) 1 .
* ( ) 2 .
* ( ) 3 .
* ( ) 4 .
* ( ) 5 .
* ( ) 6 .
* ( ) 7 ( )
.

* : Note .. .

>#include<iostream.h
) ( Function Name
{
; int , float , char variables
; Cin >> variable
; the instructions of function
}
) ( main
{
; ) ( Function Name
}

28

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language


..
( ) 28 .
: .

) * Example ( 28

* ( ) 28

>#include<iostream.h
>#include<conio.h
) ( one
{
; int x
; Cin >> x
) IF ( x % 2==0
; '' Cout << '' Even Number
Else
; '' Cout << '' Odd Number
}
) ( main
{
; ) ( Clrscr
; ) ( one
}

)(1
)(2

)(3

)(4

( ) Compiler ( ) Main ( ) one ( ) Main



:
( ) one .
* ( ) 1 .
* ( ) 2 .
* ( ) 3 .
* ( ) 4 .
* : Note ( ) 28
.

29

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

: .

) * Example ( 29

* ( ) 29

>#include<iostream.h
>#include<conio.h
) ( two
{
; int i , j=0 , x
; Cin>> x
) For ( i = 1 ; i <= x ; i++
) IF ( x % i == 0
; j ++
)IF ( j<=2
; '' Cout<< x << '' Is Prime Number
Else
; '' Cout<< x << '' Is Not Prime Number
}
) ( main
{
; ) ( Clrscr
; ) ( two
}


.

.

( ) ( ) main
.. ( ) 3 ( ) 30 .

>#include<iostream.h
) int Function Name ( int 2nd Variable
{
; the instructions of function
; ) Return ( 2nd Variable
}
) ( main
{
; int 1st Variable
; ) Function Name ( 1st Variable
}

)(1
)(2

)(3
)(4

30

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

* ( ) 1

.
* ( ) 2 .
* ( ) 3 .
* ( ) 4 .

) * Example ( 30

* ( ) 30

31

>#include<iostream.h
>#include<conio.h
) int even ( int x
{
) if ( x % 2 == 0
; '' Cout<< '' even
Else
; '' Cout<< '' odd
; ) Return ( x
}
) int Prime ( int y
{
; int i , j=0 , x
) for ( i =1 ; i <= x ; i++
) if ( x % i == 0
; j++
) if ( j <= 2
; '' Cout<<'' = ''<<'' prime
Else
; '' Cout<< '' = ''<< '' not prime
; ) Return ( y
}
) ( main
{
; ) ( Clrscr
; int c
; Cin>> c
; ) Even ( c
; ) Prime ( c
}

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

GALAXY

X-PC Seven : : xcxcomputer@yahoo.com : :

32

Turbo C++ Language



...

...
...
...

-: :

* Example ( 31 )

) 31 ( *

#include<iostream.h>
#include<math.h>
main ( )
{
int S=0 , X , i ;
Cin>> X ;
For ( i = 10 ; i >=2 ; i-=2 )
S+= pow ( X , i ) ;
Cout<< S ;
}

* Example ( 32 )

: :

) 32 ( *

#include<iostream.h>
main( )
{
int s=0 , x , k , j , i ;
Cin>> x ;
For ( i=10 ; i>=2 ; i-=2 )
{
k=1 ;
For ( j=1 ; j<= i ; j++ )
k*=x ;
S+=k ;
}
Cout<<S ;
}

X-PC Seven : : xcxcomputer@yahoo.com : :

33

Turbo C++ Language

. :

* Example ( 33 )

) 33 ( *

#include<iostream.h>
main( )
{
int i , j=0 , x ;
Cin>> x ;
For ( i = 1 ; i <= x ; i++ )
IF ( x % i == 0 )
++ j ;
IF ( j<=2)
Cout<< x << '' Prime '' ;
Else
Cout<< x << '' Not Prime '' ;
}
: ) 50 ( :

* Example ( 34 )

) 34 ( *

#include<iostream.h>
void max ( )
{
int a[50] , i=0 ;
while ( a[ i ] !=10 )
{
Cin>> a[ i ] ;
i++;
}
for ( i=1 ; i<50 ; i++ )
if ( a[ 0 ] < a[ i ] ) a[ 0 ] = a [ i ] ;
Cout<< a[ i ] ;
}
main ( )
{
max ( ) ;
}

X-PC Seven : : xcxcomputer@yahoo.com : :

34

Turbo C++ Language

: ) N ( :
. ) ( 3 **
) ** (
. **

* Example ( 35 )

) 35 ( *

#include<iostream.h>
Char inc ( char b[ 100 ] )
3
{
int m , n ;
for ( n=0 ; n<100 ; n++ )
{
m = b[ n ] + 3 ;
if ( m < 122 ) m- = 26 ;
b[ n ] = m ;
}
for ( n=0 ; n<100 ; n++ )
Cout << b[ n ] ;
Return b[ n ] ;
}
Char freq ( Char c[ 100 ] )

{
int j , k , F [ 26 ] ;
for ( j=0 ; j<26 ; j++ )
F[j]=0;
for ( j=0 ; j<100 ; j++ )
{
k = c [ j ] - 97 ;
F[k]+=1 ;
}
for ( j=0 ; j< 26 ; j++ )
Cout<< Char ( j + 97 ) << '' = '' << F [ j ] << endl ;
Return F [ j ] ;
}
Char rev ( Char d [ 100 ] ) ;

{
int S , t ;
for ( s=0 ; s<50 ; s++ )
{
t=d[s] ;
d [ s ] = d [ 99 - s ] ;
d [ 99 - s ] = t ;
}
for ( s=0 ; s< 100 ; s++ )
Cout << d [ s ] ;
Return d [ s ] ;
}
main ( )

{
Char a [ 100 ] ;
int i ;
for ( i=0 ; i<100 ; i++ )
Cin >> a [ i ] ;
inc ( a ) ;
freq ( a ) ;

rev ( a ) ;
}

X-PC Seven : : xcxcomputer@yahoo.com : :

35

Turbo C++ Language

. *

* Example ( 36 )

) 36 ( *

#include<iostream.h>
#include<conio.h>
Char freq ( char c [ 100 ] )
{
int j , k , f [ 26 ] ;
For ( j=0 ; j<26 ; j++ )
f [ j ]=0 ;
For ( j=0 ; j<100 ; j++ )
{
k = c [ j ] - 97 ;
f [ k ]+= 1 ;
}
For ( j=0 ; j<26 ; j++ )
Cout<< Char ( j + 97 )<<'' = ''<< f [ j ] << endl ;
Return f [ j ] ;
}
main( )
{
Clrscr ( ) ;
int i ;
Char a[ 100 ] ;
for( i=0 ; i<=100 ; i++ )
Cin>> a [ i ] ;
Freq ( a ) ;
}
. -: Note*

X-PC Seven : : xcxcomputer@yahoo.com : :

36

Turbo C++ Language

. *

* Example ( 37 )

) 37 ( *

#include<iostream.h>
#include<conio.h>
main ( )
{
Clrscr ( ) ;
Char C [ 100 ] ;
int i , j , k , f [ 26 ] ;
For ( i=0 ; i<100 ; i++ )
Cin>> C [ i ] ;
For ( j=0 ; j<26 ; j++ )
f [ j ]=0 ;
For ( j=0 ; j<100 ; j++ )
{
k = c [ j ] - 97 ;
f [ k ]+= 1 ;
}
For ( j=0 ; j<26 ; j++ )
Cout<< Char ( j + 97 )<<'' = ''<< f [ j ] << endl ;
Return f [ j ] ;
}

X-PC Seven : : xcxcomputer@yahoo.com : :

37

Turbo C++ Language

...
...
... Annum Examinations ...
** .
** .
** 7 1 .
** 5 . 35
** .
** ( ) N .
** .
** .
** .
** .
** ( ) asci .
** 7 .
** .
** :

38

X-PC Seven : : xcxcomputer@yahoo.com : :

Turbo C++ Language

The Author And Book Programmer


Hussam Munthir - B
Book Auditor
PROF : Yamama Abd Al-Hussain
Mohammed Ahmed
Programming Auditor
Mohammed Ahmed
PDF Creator
X-PC Seven : Hussam Munthir
PDF Created Using
Adobe InDesign CS4
Date
2012/4/30

The End

For Any Suggestion And Objection To Make


This Book Having Many Information
For It's Subject C++ Report Us At
xcxcomputer@yahoo.com
xpc.seven@yahoo.com

Without Rights Reserved@


( Free For Evryone )
X-PC Seven : : xcxcomputer@yahoo.com : :

39