SlideShare a Scribd company logo
Damascus University 
Faculty of Information Technology Engineering 
Shapes and calculate 
(area and contour) / C++ OOP concept
:ODEC 
#include<iostream> 
using namespace std; 
struct elem 
{ 
int col; 
double val; 
elem* next; 
}; 
struct HoleMat 
{ elem* mat[200]; }; 
//////////////////////////////////////////////////////////////////////////////////// 
void insert(elem* &reshead,int j,double x) 
{ 
elem* p=new elem; 
p->col=j; //intilizing node 
p->val=x; 
p->next=NULL; 
if(reshead==NULL) 
{ 
reshead=p; 
} 
else 
if(reshead->col > j) 
{ 
p->next= reshead; 
reshead=p; 
} 
else 
{ 
elem* r; 
r=reshead; 
while( (r->next != NULL)&&(r->next->col < j) ) 
{ 
r=r->next; 
}; 
p->next = r->next; 
r->next=p; 
} 
}; 
bool change(HoleMat &a,int n,int colom,int value) // to change the value if there is another value ((at the same place)) 
{ 
elem* ph; 
for(int i=1; i<=n; i++) 
{ 
ph=a.mat[i]; 
while (ph!=NULL) 
{ 
if(ph->col == colom) 
{ 
ph->val=value; 
return true; 
} 
else 
{ 
ph=ph->next; 
} 
} 
} 
return false; 
}; 
void ReadHMat(HoleMat& a,int n,int &maxcol) 
{ 
maxcol=-4; 
char w=' '; 
int j1,i1; 
double e1; 
for(int i=0; i<200; i++) ///creatig NULL array; 
{ 
a.mat[i]=NULL;
}; 
do 
{ 
cout<<"the element: n"; 
cin>>e1; 
cout<<"the row number: "<<" <= "<<n<<endl; 
cin>>i1; 
cout<<"the colom number: n"; 
cin>>j1; 
if(change(a,n,j1,e1) ) //change the value with th NEW 
{ 
cout<<"there is an elem at the same colom(changed) !! reputn"; 
} 
else 
insert(a.mat[i1],j1,e1); 
if(j1>maxcol) //find max col for matrix 
maxcol=j1; 
start: cout<<"read element again?!!(y or n).. :n"; 
cin>>w; 
if( (w!='y')&&(w!='n')) 
goto start; 
} 
while(w != 'n'); 
}; 
void WriteHMat(HoleMat a,int n,int maxcol) 
{ 
for(int i=1; i<= n; i++) 
{ 
if(a.mat[i] == NULL) //for print 0 whole line 
for(int j=1; j<=maxcol;j++) 
{ 
cout<<" 0 "; 
} 
cout<<endl; 
elem* ls =a.mat[i]; 
int k=1; 
while (ls != NULL) 
{ 
if(ls->col == k) 
{ 
cout<<"( "<< ls->col<<" )| " <<ls->val<<" "; 
ls=ls->next; 
} 
else 
{ cout<<" 0 "; } 
k++; 
} 
if( (k != maxcol)&&( k!= 1) ) // to complet the line with 0 
for(int q=k; q<=maxcol; q++) 
cout<<" 0 "; 
if(a.mat[i] != NULL) //to Not print spaces!! 
cout<<endl; 
};//for 
}; 
void putcurrent(elem*& head,elem* &current,double v1,int c1) //& current 
{ 
elem* temp=new elem; 
temp->col=c1; 
temp->val=v1; 
temp->next=NULL; 
if(current==NULL) 
{ 
head=temp; 
current=temp; 
} 
else 
{
current->next = temp; 
current = current->next; 
} 
}; 
void addmat(HoleMat a,HoleMat b,HoleMat& res,int n1) // & res 
{ 
for(int i=0; i<200; i++) ///creatig NULL array to max 200; 
{ 
res.mat[i]=NULL; 
}; 
for(int i=1; i<= n1 ;i++) 
{ 
elem* p1=a.mat[i]; 
elem* p2=b.mat[i]; 
elem* current; 
current=NULL; 
while( (p1 != NULL)&&(p2 !=NULL) ) //comparing and put the least.. 
{ 
if(p1 ->col < p2->col) 
{ 
putcurrent(res.mat[i],current,p1->val,p1->col); 
p1 = p1->next; 
} 
else if (p2 ->col < p1->col) 
{ 
putcurrent(res.mat[i],current,p2->val,p2->col); 
p2 = p2->next; 
} 
else // == 
{ 
double sum=p1->val + p2->val ; 
putcurrent(res.mat[i],current,sum,p1->col); 
p1 = p1->next; 
p2 = p2->next; 
} 
};//while 
while(p1 != NULL) //for what is left in a .. 
{ 
putcurrent(res.mat[i],current,p1->val,p1->col); 
p1 = p1->next; 
}; 
while(p2 != NULL) //for what is left in b .. 
{ 
putcurrent(res.mat[i],current,p2->val,p2->col); 
p2 = p2->next; 
}; 
};//for 
}; 
double SumHMat(HoleMat z,int n) 
{ 
double sum=0; 
elem* ph; 
for(int i=1; i<=n; i++) 
{ 
ph=z.mat[i]; 
while (ph != NULL) 
{ 
sum=sum + ph->val; 
ph=ph->next; 
} 
}; 
return sum; 
}; 
double MaxMat(HoleMat y,int n) 
{ 
double max; 
int maxrow,maxcol; 
int i=1; // find the first row != NUll to give Max an intilize value 
elem* t; //auxitiare 
while ( y.mat[i] == NULL) 
{ i++ ; }; 
max=y.mat[i] ->val; 
for(int j=i; j<=n;j++)
{ 
t=y.mat[j]; 
while(t != NULL) 
{ 
if( t->val > max) 
{ 
max= t->val; 
maxrow=j; 
maxcol=t->col; 
} 
t=t->next; 
}; 
}; 
// just print max's node 
cout<<"( "<<maxrow<<" , "<<maxcol<<" )| " <<max<<" "; 
return max; 
}; 
////////////////////////////////////////////////////////////////////////////////// 
void main() 
{ 
HoleMat a,b,res,z,y; 
int max; 
char c=' '; 
int n,n1,n2; //row dimention.. 
while( c != '0') 
{ 
cout<<"|----------------------------------------------------------------------|n"; 
cout<<"| CHOICE MENU |n" ; 
cout<<"|-----|----|-----------------------------------------------------------|n"; 
cout<<"| |(1)-| Read your matrix: 'press (1) ' |n"; 
cout<<"| --|----|------------------------------------------- |n"; 
cout<<"| |(2)-| writeMatrix : 'press (2) ' |n"; 
cout<<"| --|----|------------------------------------------- |n"; 
cout<<"| |(3)-| Add two matrix 'press (3) ' |n"; 
cout<<"| --|----|------------------------------------------- |n"; 
cout<<"| |(4)-| sum all matrix elements : 'press (4) ' |n"; 
cout<<"| --|----|------------------------------------------- |n"; 
cout<<"| |(5)-| Find Max element int the Matrix : 'press (5) ' |n"; 
cout<<"| --|----|------------------------------------------- |n"; 
cout<<"| |(0)-| to EXIT.. 'press (0) ' |n"; 
cout<<"|-----|----|-----------------------------------------------------------|n"; 
cout<<"|----------------------------------------------------------------------|n"; 
cout<<"enter your choice : "; 
cin>>c; 
switch(c) 
{ 
case '1': { 
cout<<"enter the all row(max row number) number: n"; 
cin>>n; 
ReadHMat(a,n,max); 
cout<<"------------------------------------------------------------------------n"; 
break; 
}; 
case'2': { 
cout<<"WRITEMAT...............n"; 
WriteHMat(a,n,max); 
cout<<"---------------------------------------------------------------------------- n"; 
break; 
}; 
case'3': { 
cout<<"FIrst matrix: n"; 
cout<<"enter the all row(max row number) number: n"; 
cin>>n1; 
ReadHMat(a,n1,max); 
WriteHMat(a,n1,max); 
// 
cout<<"Second matrix: n"; 
cout<<"enter the all row(max row number) number: n"; 
cin>>n2; 
ReadHMat(b,n2,max);
WriteHMat(b,n2,max); 
if(n1 != n2) 
{ 
cout<<"cannot do the add n1!=n2 n"; 
break; 
} 
addmat(a,b,res,n1); 
cout<<"******the RES*******n"; 
WriteHMat(res,n1,max); 
break; 
}; 
case'4':{ 
cout<<"enter the all row(max row number) number: n"; 
cin>>n; 
cout<<"Put the matrix: n"; 
ReadHMat(z,n,max); 
WriteHMat(z,n,max); 
cout<<"the sum of all elements = n"; 
cout<<SumHMat(z,n)<<endl; 
break; 
}; 
case'5': { 
cout<<"enter the all row(max row number) number: n"; 
cin>>n; 
cout<<"Put the matrix: n"; 
ReadHMat(y,n,max); 
WriteHMat(y,n,max); 
cout<<"the Max number in it= "<<MaxMat(y,n)<<endl; 
break; 
}; 
case'0': 
{ 
cout<<"End Program..My wishes :D....n"; 
break; 
}; 
default: { cout<<"error value..n"; break;}; 
}; 
};//while 
system("pause");

More Related Content

What's hot

Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
pratikbakane
 
Tower of HANOI
Tower of HANOITower of HANOI
Tower of HANOI
Er. Ganesh Ram Suwal
 
C++ TUTORIAL 5
C++ TUTORIAL 5C++ TUTORIAL 5
C++ TUTORIAL 5
Farhan Ab Rahman
 
Implementation of c string functions
Implementation of c string functionsImplementation of c string functions
Implementation of c string functions
mohamed sikander
 
Cpp programs
Cpp programsCpp programs
Cpp programs
harman kaur
 
C questions
C questionsC questions
C questions
mohamed sikander
 
C++ TUTORIAL 4
C++ TUTORIAL 4C++ TUTORIAL 4
C++ TUTORIAL 4
Farhan Ab Rahman
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
pratikbakane
 
TSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) DropboxTSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) DropboxSeb Sear
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
pratikbakane
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
Farhan Ab Rahman
 
Freeing Tower Bridge
Freeing Tower BridgeFreeing Tower Bridge
Freeing Tower Bridge
Dave Cross
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
pratikbakane
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
Farhan Ab Rahman
 
Conversion of data types in java
Conversion of data types in javaConversion of data types in java
Conversion of data types in java
One97 Communications Limited
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
pratikbakane
 
Ct es past_present_future_nycpgday_20130322
Ct es past_present_future_nycpgday_20130322Ct es past_present_future_nycpgday_20130322
Ct es past_present_future_nycpgday_20130322David Fetter
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
Standing the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider PatternStanding the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider Pattern
Derek Lee Boire
 

What's hot (20)

week-5x
week-5xweek-5x
week-5x
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
Tower of HANOI
Tower of HANOITower of HANOI
Tower of HANOI
 
C++ TUTORIAL 5
C++ TUTORIAL 5C++ TUTORIAL 5
C++ TUTORIAL 5
 
Implementation of c string functions
Implementation of c string functionsImplementation of c string functions
Implementation of c string functions
 
Cpp programs
Cpp programsCpp programs
Cpp programs
 
C questions
C questionsC questions
C questions
 
C++ TUTORIAL 4
C++ TUTORIAL 4C++ TUTORIAL 4
C++ TUTORIAL 4
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
TSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) DropboxTSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) Dropbox
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
 
Freeing Tower Bridge
Freeing Tower BridgeFreeing Tower Bridge
Freeing Tower Bridge
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
 
Conversion of data types in java
Conversion of data types in javaConversion of data types in java
Conversion of data types in java
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
Ct es past_present_future_nycpgday_20130322
Ct es past_present_future_nycpgday_20130322Ct es past_present_future_nycpgday_20130322
Ct es past_present_future_nycpgday_20130322
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
Standing the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider PatternStanding the Test of Time: The Date Provider Pattern
Standing the Test of Time: The Date Provider Pattern
 

Viewers also liked

C++ by shantu
C++ by shantuC++ by shantu
C++ by shantu
Shant007
 
Presentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ ProjectPresentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ Project
Chandan Gupta Bhagat
 
Tic tac toe c++ project presentation
Tic tac toe c++ project presentationTic tac toe c++ project presentation
Tic tac toe c++ project presentationSaad Symbian
 
Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programs
harman kaur
 

Viewers also liked (7)

C++ by shantu
C++ by shantuC++ by shantu
C++ by shantu
 
C++ super market
C++ super marketC++ super market
C++ super market
 
Presentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ ProjectPresentation of 3rd Semester C++ Project
Presentation of 3rd Semester C++ Project
 
Tic tac toe c++ project presentation
Tic tac toe c++ project presentationTic tac toe c++ project presentation
Tic tac toe c++ project presentation
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programs
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 

Similar to Shapes and calculate (area and contour) / C++ oop concept

#include iostream#include d_node.h #include d_nodel.h.docx
#include iostream#include d_node.h #include d_nodel.h.docx#include iostream#include d_node.h #include d_nodel.h.docx
#include iostream#include d_node.h #include d_nodel.h.docx
ajoy21
 
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
Adamq0DJonese
 
Data StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdf
Data StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdfData StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdf
Data StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdf
rozakashif85
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfI need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
forladies
 
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
pasqualealvarez467
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
C++ Homework Help
 
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
anujmkt
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
Eleanor McHugh
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
 
Hi,you covered mostly things.there are issue to point and link poi.pdf
Hi,you covered mostly things.there are issue to point and link poi.pdfHi,you covered mostly things.there are issue to point and link poi.pdf
Hi,you covered mostly things.there are issue to point and link poi.pdf
aryan9007
 
Dsprograms(2nd cse)
Dsprograms(2nd cse)Dsprograms(2nd cse)
Dsprograms(2nd cse)
Pradeep Kumar Reddy Reddy
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
feelinggift
 
Please fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdfPlease fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdf
amarnathmahajansport
 
This is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdfThis is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdf
kostikjaylonshaewe47
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
MomenMostafa
 
C++ adt c++ implementations
C++   adt c++ implementationsC++   adt c++ implementations
C++ adt c++ implementations
Rex Mwamba
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
vrgokila
 

Similar to Shapes and calculate (area and contour) / C++ oop concept (20)

#include iostream#include d_node.h #include d_nodel.h.docx
#include iostream#include d_node.h #include d_nodel.h.docx#include iostream#include d_node.h #include d_nodel.h.docx
#include iostream#include d_node.h #include d_nodel.h.docx
 
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
-- Task 2- Debugging a program with stacks- queues- and doubly-linked.docx
 
Data StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdf
Data StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdfData StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdf
Data StructuresPLEASE USING THIS C++ PROGRAM BELOW, I NEED HEL.pdf
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdfI need to fill-in TODOs in .cpp file and in .h file Could some.pdf
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
 
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Hi,you covered mostly things.there are issue to point and link poi.pdf
Hi,you covered mostly things.there are issue to point and link poi.pdfHi,you covered mostly things.there are issue to point and link poi.pdf
Hi,you covered mostly things.there are issue to point and link poi.pdf
 
Dsprograms(2nd cse)
Dsprograms(2nd cse)Dsprograms(2nd cse)
Dsprograms(2nd cse)
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Please fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdfPlease fill in the code to run the program based on the following in.pdf
Please fill in the code to run the program based on the following in.pdf
 
This is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdfThis is a c++ binary search program I worked so far but still cant g.pdf
This is a c++ binary search program I worked so far but still cant g.pdf
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
 
week-18x
week-18xweek-18x
week-18x
 
week-17x
week-17xweek-17x
week-17x
 
C++ adt c++ implementations
C++   adt c++ implementationsC++   adt c++ implementations
C++ adt c++ implementations
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 

More from kinan keshkeh

10 Little Tricks to Get Your Class’s Attention (and Hold It)
10 Little Tricks to Get Your  Class’s Attention (and Hold It)10 Little Tricks to Get Your  Class’s Attention (and Hold It)
10 Little Tricks to Get Your Class’s Attention (and Hold It)
kinan keshkeh
 
GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm  GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm
kinan keshkeh
 
Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...
kinan keshkeh
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
kinan keshkeh
 
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
kinan keshkeh
 
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists
kinan keshkeh
 
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
kinan keshkeh
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
kinan keshkeh
 
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles
kinan keshkeh
 
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles
kinan keshkeh
 
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
kinan keshkeh
 
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism
kinan keshkeh
 
2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance
kinan keshkeh
 
2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces 2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces
kinan keshkeh
 
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays 2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
kinan keshkeh
 

More from kinan keshkeh (20)

10 Little Tricks to Get Your Class’s Attention (and Hold It)
10 Little Tricks to Get Your  Class’s Attention (and Hold It)10 Little Tricks to Get Your  Class’s Attention (and Hold It)
10 Little Tricks to Get Your Class’s Attention (and Hold It)
 
GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm  GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm
 
Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
 
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
 
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists
 
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
 
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles
 
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles
 
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
 
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism
 
2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance
 
2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces 2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces
 
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays 2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
 

Recently uploaded

Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 

Recently uploaded (20)

Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 

Shapes and calculate (area and contour) / C++ oop concept

  • 1. Damascus University Faculty of Information Technology Engineering Shapes and calculate (area and contour) / C++ OOP concept
  • 2. :ODEC #include<iostream> using namespace std; struct elem { int col; double val; elem* next; }; struct HoleMat { elem* mat[200]; }; //////////////////////////////////////////////////////////////////////////////////// void insert(elem* &reshead,int j,double x) { elem* p=new elem; p->col=j; //intilizing node p->val=x; p->next=NULL; if(reshead==NULL) { reshead=p; } else if(reshead->col > j) { p->next= reshead; reshead=p; } else { elem* r; r=reshead; while( (r->next != NULL)&&(r->next->col < j) ) { r=r->next; }; p->next = r->next; r->next=p; } }; bool change(HoleMat &a,int n,int colom,int value) // to change the value if there is another value ((at the same place)) { elem* ph; for(int i=1; i<=n; i++) { ph=a.mat[i]; while (ph!=NULL) { if(ph->col == colom) { ph->val=value; return true; } else { ph=ph->next; } } } return false; }; void ReadHMat(HoleMat& a,int n,int &maxcol) { maxcol=-4; char w=' '; int j1,i1; double e1; for(int i=0; i<200; i++) ///creatig NULL array; { a.mat[i]=NULL;
  • 3. }; do { cout<<"the element: n"; cin>>e1; cout<<"the row number: "<<" <= "<<n<<endl; cin>>i1; cout<<"the colom number: n"; cin>>j1; if(change(a,n,j1,e1) ) //change the value with th NEW { cout<<"there is an elem at the same colom(changed) !! reputn"; } else insert(a.mat[i1],j1,e1); if(j1>maxcol) //find max col for matrix maxcol=j1; start: cout<<"read element again?!!(y or n).. :n"; cin>>w; if( (w!='y')&&(w!='n')) goto start; } while(w != 'n'); }; void WriteHMat(HoleMat a,int n,int maxcol) { for(int i=1; i<= n; i++) { if(a.mat[i] == NULL) //for print 0 whole line for(int j=1; j<=maxcol;j++) { cout<<" 0 "; } cout<<endl; elem* ls =a.mat[i]; int k=1; while (ls != NULL) { if(ls->col == k) { cout<<"( "<< ls->col<<" )| " <<ls->val<<" "; ls=ls->next; } else { cout<<" 0 "; } k++; } if( (k != maxcol)&&( k!= 1) ) // to complet the line with 0 for(int q=k; q<=maxcol; q++) cout<<" 0 "; if(a.mat[i] != NULL) //to Not print spaces!! cout<<endl; };//for }; void putcurrent(elem*& head,elem* &current,double v1,int c1) //& current { elem* temp=new elem; temp->col=c1; temp->val=v1; temp->next=NULL; if(current==NULL) { head=temp; current=temp; } else {
  • 4. current->next = temp; current = current->next; } }; void addmat(HoleMat a,HoleMat b,HoleMat& res,int n1) // & res { for(int i=0; i<200; i++) ///creatig NULL array to max 200; { res.mat[i]=NULL; }; for(int i=1; i<= n1 ;i++) { elem* p1=a.mat[i]; elem* p2=b.mat[i]; elem* current; current=NULL; while( (p1 != NULL)&&(p2 !=NULL) ) //comparing and put the least.. { if(p1 ->col < p2->col) { putcurrent(res.mat[i],current,p1->val,p1->col); p1 = p1->next; } else if (p2 ->col < p1->col) { putcurrent(res.mat[i],current,p2->val,p2->col); p2 = p2->next; } else // == { double sum=p1->val + p2->val ; putcurrent(res.mat[i],current,sum,p1->col); p1 = p1->next; p2 = p2->next; } };//while while(p1 != NULL) //for what is left in a .. { putcurrent(res.mat[i],current,p1->val,p1->col); p1 = p1->next; }; while(p2 != NULL) //for what is left in b .. { putcurrent(res.mat[i],current,p2->val,p2->col); p2 = p2->next; }; };//for }; double SumHMat(HoleMat z,int n) { double sum=0; elem* ph; for(int i=1; i<=n; i++) { ph=z.mat[i]; while (ph != NULL) { sum=sum + ph->val; ph=ph->next; } }; return sum; }; double MaxMat(HoleMat y,int n) { double max; int maxrow,maxcol; int i=1; // find the first row != NUll to give Max an intilize value elem* t; //auxitiare while ( y.mat[i] == NULL) { i++ ; }; max=y.mat[i] ->val; for(int j=i; j<=n;j++)
  • 5. { t=y.mat[j]; while(t != NULL) { if( t->val > max) { max= t->val; maxrow=j; maxcol=t->col; } t=t->next; }; }; // just print max's node cout<<"( "<<maxrow<<" , "<<maxcol<<" )| " <<max<<" "; return max; }; ////////////////////////////////////////////////////////////////////////////////// void main() { HoleMat a,b,res,z,y; int max; char c=' '; int n,n1,n2; //row dimention.. while( c != '0') { cout<<"|----------------------------------------------------------------------|n"; cout<<"| CHOICE MENU |n" ; cout<<"|-----|----|-----------------------------------------------------------|n"; cout<<"| |(1)-| Read your matrix: 'press (1) ' |n"; cout<<"| --|----|------------------------------------------- |n"; cout<<"| |(2)-| writeMatrix : 'press (2) ' |n"; cout<<"| --|----|------------------------------------------- |n"; cout<<"| |(3)-| Add two matrix 'press (3) ' |n"; cout<<"| --|----|------------------------------------------- |n"; cout<<"| |(4)-| sum all matrix elements : 'press (4) ' |n"; cout<<"| --|----|------------------------------------------- |n"; cout<<"| |(5)-| Find Max element int the Matrix : 'press (5) ' |n"; cout<<"| --|----|------------------------------------------- |n"; cout<<"| |(0)-| to EXIT.. 'press (0) ' |n"; cout<<"|-----|----|-----------------------------------------------------------|n"; cout<<"|----------------------------------------------------------------------|n"; cout<<"enter your choice : "; cin>>c; switch(c) { case '1': { cout<<"enter the all row(max row number) number: n"; cin>>n; ReadHMat(a,n,max); cout<<"------------------------------------------------------------------------n"; break; }; case'2': { cout<<"WRITEMAT...............n"; WriteHMat(a,n,max); cout<<"---------------------------------------------------------------------------- n"; break; }; case'3': { cout<<"FIrst matrix: n"; cout<<"enter the all row(max row number) number: n"; cin>>n1; ReadHMat(a,n1,max); WriteHMat(a,n1,max); // cout<<"Second matrix: n"; cout<<"enter the all row(max row number) number: n"; cin>>n2; ReadHMat(b,n2,max);
  • 6. WriteHMat(b,n2,max); if(n1 != n2) { cout<<"cannot do the add n1!=n2 n"; break; } addmat(a,b,res,n1); cout<<"******the RES*******n"; WriteHMat(res,n1,max); break; }; case'4':{ cout<<"enter the all row(max row number) number: n"; cin>>n; cout<<"Put the matrix: n"; ReadHMat(z,n,max); WriteHMat(z,n,max); cout<<"the sum of all elements = n"; cout<<SumHMat(z,n)<<endl; break; }; case'5': { cout<<"enter the all row(max row number) number: n"; cin>>n; cout<<"Put the matrix: n"; ReadHMat(y,n,max); WriteHMat(y,n,max); cout<<"the Max number in it= "<<MaxMat(y,n)<<endl; break; }; case'0': { cout<<"End Program..My wishes :D....n"; break; }; default: { cout<<"error value..n"; break;}; }; };//while system("pause");