.
.
.
مساء الخير..
مطلوب منا هاد البرنامج مشروع :blink:
write a c++ programing to perform the matrix manipulation as showing in the main menu below:
1-youre program should have a function for each process.
2-youre program should returned to the main menu after showing the needed process output.
3-Matrix A and B could have any size from 1*1 to10*10.
4-use comment in your program to clarify ambiguous statements.
<1> Fill A&B
<2> Sum of A&B
<3> Product of A&B
<4> Transpost of A
<5> Is A symmetric
<6> Det (A)
<7> Inv (A)
<8> To Exite
هلا انا بلشت في وحليتو
بس المطلوب السادس ((المحددات))والمطلوب السابع ((المعكوس))هدول ولا اشي عارفه فيهم :unsure: ..
بليز ساعدوني وما تقصرو معي محتاجيتو ضروري..
الليله اخر موعد معي..وانا هلا بامتحانات الفانل فما في معي وقت اضيعوو اكتر من اللي ضاع بدون فايده :sad: ...
علما اني مبتداه بالبرمجه..وشكلي مش رح استمر : :S
الله يوفقكم ويسعدكم ما تقصرو معي ..:sad: :sad:
وجزاكو الله خير :)
هي البرنامج ..
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <conio.h>
int A[10][10],B[10][10],result[10][10];
void sum(int A[][10],int B[][10],int size)
{
for(int i=0;i<size;i++)
{
for(int j=0;j<size;j++)
result[j]=A[j]+B[j];
}
}
//-----------------
void Enter(int A[][10],int B[][10],int size)
{
int i,j;
for( i=0;i<size;i++)
for( j=0;j<size;j++)
{
cout<<"A["<<i<<"]["<<j<<"] = ";
cin>>A[j];
}
for( i=0;i<size;i++)
for( j=0;j<size;j++)
{
cout<<"B["<<i<<"]["<<j<<"] = ";
cin>>B[j];
}
}
//-----------------
void show(int A[][10],int size)
{
for (int i=0;i<size;i++)
{
for (int j=0;j<size;j++)
{
cout<<A[j]<<" ";
}
cout<<endl;
}
}
//-----------------
//// multiplication/////
void product(int A[][10],int B[][10],int size)
{
int i,j,k;
int s=0;
for (i=0;i<size;i++)
{
for (j=0;j<size;j++)
{
for (k=0;k<size;k++)
{
s+=A[k]*B[k][j];
}
result[j]=s;
s=0;
}
}
}
//====================
void TranspostA(int A[][10],int B[][10],int size)
{
if(A==NULL)
{
cout<<"Arrays Are Empty";
return;
}
else
{
int i,j;
for(i=0 ; i<size ; i++)
{
for(j=0 ; j<size ; j++)
{
cout<<A[j]<<" ";
}
cout<<endl;
}
}
}
//====================
bool IsA_Symmetric(int A[][10],int B[][10],int size)
{
if(A==NULL)
{
cout<<"Arrays Are Empty";
return false;
}
else
{
int i,j;
for(i=0 ; i<size ; i++)
{
for(j=0 ; j<size ; j++)
{
if(A[j]!=A[j])
return false;
}
}
}
return true;
}
//====================
void Det(int A[][10],int B[][10],int size)
{
}
//====================
void Inv(int A[][10],int B[][10],int size)
{
}
//===========================
void menu()
{
system("CLS");
cout<<"\n\n";
cout<<" ============================================="<<endl;
cout<<" * ^_^ Main Menu ^_^ *"<<endl;
cout<<" ============================================="<<endl;
cout<<" * <1> Fill A&B *"<<endl;
cout<<" * <2> Sum of A&B *"<<endl;
cout<<" * <3> Product of A&B *"<<endl;
cout<<" * <4> Transpose of A *"<<endl;
cout<<" * <5> Is A symmetric *"<<endl;
cout<<" * <6> Det (A) *"<<endl;
cout<<" * <7> Inv (A) *"<<endl;
cout<<" * <8> To Exite *"<<endl;
cout<<" ============================================="<<endl;
cout<<" Please enter your choice : "<<endl;
}
//******************************************************************************
int main()
{
int size;
cout<<"enter the size of matrex :"<<endl;
cin>>size;
menu();
int h;
cin>>h;
while(h!=8)
{
switch(h)
{
case 1:
{
Enter(A,B,size);
getch();
menu();
cin>>h;
}
break;
//------------------------
case 2:
{
sum(A,B,size);
show(A,size);
cout<<"+"<<endl;
show(B,size);
cout<<"\n------------------------------\n";
show(result,size);
getch();
menu();
cin>>h;
}
break;
//------------------------
case 3:
{
product(A,B,size);
show(A,size);
cout<<"X"<<endl;
show(B,size);
cout<<"\n------------------------------\n";
show(result,size);
getch();
menu();
cin>>h;
}
break;
//------------------------
case 4:
{
TranspostA(A,B,size);
getch();
menu();
cin>>h;
}
break;
//------------------------
case 5:
{
if(IsA_Symmetric(A,B,size))
cout<<"A is Symmetric";
else
cout<<"A is Asymmetric";
getch();
menu();
cin>>h;
}
break;
//------------------------
case 6:
{
getch();
menu();
cin>>h;
}
break;
//------------------------
case 7:
{
getch();
menu();
cin>>h;
}
break;
//------------------------
}//end switch
}//end while
return 0;
}