You are on page 1of 7

www.IrPDF.

com

Farsi e-learning series

www.IrPDF.com

Farsi e-learning series


&'&

" # $ !%

#include <iostream.h>
#include <conio.h>
int calc(int [],int dim);
void revmatrix( int [],int dim);
void main()
{
int matrix[1000];
int dim,temp;
double leftsum,rightsum;
cout<<"
PLEASE ENTER MATRIX DIMANTION : ";
cin>>dim;
cout<<"\n\n\n";
for( int i = 0;i<( dim*dim );i ++ )
{
cout<<"ENTER ELEMAN : ";
cin>>temp;
matrix[i] = temp;
clrscr();
cout<<"
PLEASE ENTER MATRIX DIMANTION : "<<dim;
cout<<"\n\n\n";
}//for i
if ( dim > 2 )
{
leftsum = calc( matrix , dim );
cout<<"LEFTSUM of the matrix = "<< leftsum <<"\n\n";
revmatrix( matrix , dim );
rightsum = calc( matrix ,dim );
cout<<"RIGHTSUM of the matrix = "<< rightsum <<"\n\n\n\n\n\n" ;
cout<<"
( DETERMINAN OF THE MATRIX = "<< leftsum - rightsum<<" )";
}
else
cout<<"
* matrix[2])<<" )";

( DETERMINAN OF THE MATRIX = "<<(matrix[0] * matrix[3] - matrix[1]

getch();
}//end main
/////////////////calc function//////////
int calc( int matrix[ ], int dim )
{
int sum = 0, bul, x = 1;
for( int l = 0; l<( dim*dim );l += ( dim+1 ) )//ghotr asli
x *= matrix[l];
sum = x;
x = 1;
for( int c = 1;c<dim;c ++ )
{
bul=c;
for( int m = 0;m<dim;m ++ )
{
if( ( bul+1 )%dim != 0 )
{
x *= matrix[bul];

www.IrPDF.com

Farsi e-learning series


bul +=( dim + 1 );
}
else
{
x = x * matrix[bul];
bul += 1;
}
}//for m
sum += x;
x = 1;
}//for c
return sum;
}
////////////////////revmatriv determinan
void revmatrix(int matrix[ ],int dim)
{
int end,temp,counter;
for( int t = dim-1;t <= dim*dim;t = t + dim )

{
end=t;
counter = end -( dim-1 );
while( end > counter )
{
temp = matrix[end];
matrix[end] = matrix[counter];
matrix[counter] = temp;
++ counter;
-- end;
}
}
}
/

0 ,-

-123 *

% * % $4

) "

%* * 5

67 * ,89 :

; "
, 0 " % ) * + ,, .
=< ,. % % % * ,89 : %* * 5 ,, 0 %

#include <iostream.h>
int main()
{
int i,j;
double a[512],b;
cout<<How many content do you want to enter ?:;
cin >>i;
cout<<Enter <<i<< contents :;
for(j=0;j<i;j++)
cin>> a[j];
cout<<Enter a keyword to search in your array : ;
cin >> b;
(

www.IrPDF.com

Farsi e-learning series


for(j=0;j<i;j++)
{
if (a[j]==b)
{
break;
}
}
if (j>=i)
cout << "not found" << endl;
else
cout <<Hurray !! your searched content is in this row :
<< j << endl;
return 0;
}

>

www.IrPDF.com

Farsi e-learning series


J% 9 3 7 # !3

8- -

,8

% % I%

3 C ;!

I
3 QRSS O P )
% % X . 5 D E Y$ . 3 ,8
T

I
I @9 : 8- - ,

8- - D E # ! 3 Y

-" -

@9 :

8- - D E ,- @7

8- -

, 05
I% ,,8-

3F . ,GH = @A$.
% ,4. 8- - , 83 MN
8- -B .5 , 0"

,8
%% 5
B . ,8
-D E
III * D F
,8
K8. @ LF
% % TUVVW D F L

MN

,8

" # P #* F

. !3

[A 5

- D E % F $\8 "
)
.
#0 # ! 3 Y
b% - % `87 * a* 5 # ! 3

$A % MN

8- - Z * %

8- ,8
"
) /89 :
,8
$\8 C ;! # 5 % ^)9 ,8 _ ]

Char ali[26]=WWW.MRH.IR;
Char aida[26]={ m , a

, j , i , d }
I $ %

f. Y ,)Hc "

Y * de&

-12

@_ c*% /

$8A. ! 3 Z * % ,-

I Y$ - 3
c
" B*
+ * ,89 : ,8
" ,- $A

,8

, .

#include <iostream.h>
int main()
{
char a[64];
int i,c;
cout<<"Enter a strings:"<<endl;
cin>>a;
for(int i=0; a[i]!='\0'; i++);
cout<<"Size of string : " <<i<<endl;
return 0;
}
I%

5D E J

-12

.0

+ * ,89 :

,8

3;

f.

- /$

,- Y$A

3; ! Y$

#include <iostream.h>
void size(char a[],char b[])
{
int i;
for(i=0; a[i]!='\0'; i++);
cout<<"Size of string : " <<i<<endl;
}

int main()
{
char a[64];
int i,c;
cout<<"Enter a strings:"<<endl;
cin>>a;
size(a);
return 0;
}

- 36- 3_* %
?

3 *% * ,89 :

,8

) *% ,- $A

, .

www.IrPDF.com

Farsi e-learning series


#include <iostream.h>
int main()
{
char a[64],b[64];
cout<<"Enter 2 strings:"<<endl;
cin>>a;
cin>>b;
int i=0;
do{
a[i]=b[i];
}while(b[i++]!='\0');
a[i]='\0';
return 0;
}

I $ % f.
E9 /
0D
8A d
,. h 8- % 3
Z !
%J .
0 a5
/
I .
3 C ;! lmne&oIT
,. h 8- % 8A
,8
, ,- J % % $A p 9 3A . , .
# 5 4% J# 5/ %
,8

! 8j$ 3
0 * 8K / !
E9 0 % ,- 3
/ ! )!
-, k
,- J
,. h 8- Z ! /
$\8 ,- J
6A +
,8G. /

IY 5 % P 3 #0 , *

9 7

q$r !

smne&oIT

smne&oIT
smne&oIT

smne&oIT
smne&oIT
smne&oIT
smne&oIT
smne&oIT

I
3

,8
J%

"

8: } 3 *% : J . % : 3
%
I .% : 3
N .%
g

,f$8. *

-3

,8
)
K.0 * ,89 : ,8
,G { I - 3
8: } 3_* : *
: * .% :
,A ) Y

Z !
smnVU&bt]
smnduvbtwx]
smn&duvbtwxw&]
smnnUybt]
smndtmbtwx]
smn&dtmbtwxw&]

I - 3 36- 4 % %
,8
- 3 36- 8- - & % ;! , - c
4% %

I -3
GF
I -3
E8 Y ,
% 8- - & - c z c
,8

I .% : 3

,8

,8

,8
*%
E8 Y ,
- 3 ,j )
*% 5

,8

*%
,8

* 8- - Q

*%

smnd|ubtwx]
smn&d|ubtwxw&]

www.IrPDF.com

Farsi e-learning series


D

I - 36- 3_* % 3 *% * ,89 : ,8


*% ,- $A
3; ! ,G 3 ; I $ G Z ! ,
!
I .% :
.%
: * . % : N J % 8: } 3 *% : I . % :
J % 8: } 3_* : * % $4
,8
*% ,- $A
3_* %
*%
,8
@ K. % * % - ,A )
K.0 g / ! . J 1 2
+ J ,89 : ,8
*% ,- $A
b
,89 : %* * 5 & ] I % f.
,8
* 8- - & *
/ ! ,- $A
I - E8 4
,
K.0 * ,89 : ,8
*% Z ! " 5 % `87 ,- $A
,89 : %* * 5 & ] I
%
,f$8. %
K.0 5 ,8
& * % - E8 Y ,
,8
*% 3; ! 5 % `87 ,- $A
I GF
,8
) " 3; ! 5 % `87 ,- $A

"# $ % &
., /,&

'( )

*+ , -

www.mrh.ir
www.majidonline.com

(? 1

2 3

,& , 45

6 789 ':) ;

<

(
3; !
, .
, .
, .
, .
, .

(
>
?
i
~

You might also like