Enviar pesquisa
Carregar
Shapes and calculate (area and contour) / C++ oop concept
•
0 gostou
•
263 visualizações
kinan keshkeh
Seguir
Shapes and calculate (area and contour) / C++ oop concept
Leia menos
Leia mais
Software
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 6
Baixar agora
Baixar para ler offline
Recomendados
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods
kinan keshkeh
Program(Output)
Program(Output)
princy75
bank management system
bank management system
Aisha Aisha
C++ Programming - 14th Study
C++ Programming - 14th Study
Chris Ohk
Vcs29
Vcs29
Malikireddy Bramhananda Reddy
matlab code of shifting and folding of two sequences
matlab code of shifting and folding of two sequences
Rakesh kumar jha
Implementation of c string functions
Implementation of c string functions
mohamed sikander
Recomendados
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods
kinan keshkeh
Program(Output)
Program(Output)
princy75
bank management system
bank management system
Aisha Aisha
C++ Programming - 14th Study
C++ Programming - 14th Study
Chris Ohk
Vcs29
Vcs29
Malikireddy Bramhananda Reddy
matlab code of shifting and folding of two sequences
matlab code of shifting and folding of two sequences
Rakesh kumar jha
Implementation of c string functions
Implementation of c string functions
mohamed sikander
week-5x
week-5x
KITE www.kitecolleges.com
Tower of HANOI
Tower of HANOI
Er. Ganesh Ram Suwal
C++ TUTORIAL 5
C++ TUTORIAL 5
Farhan Ab Rahman
TSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) Dropbox
Seb Sear
Freeing Tower Bridge
Freeing Tower Bridge
Dave Cross
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
C++ TUTORIAL 1
C++ TUTORIAL 1
Farhan Ab Rahman
C++ TUTORIAL 4
C++ TUTORIAL 4
Farhan Ab Rahman
Cpp programs
Cpp programs
harman kaur
Ct es past_present_future_nycpgday_20130322
Ct es past_present_future_nycpgday_20130322
David Fetter
C++ TUTORIAL 8
C++ TUTORIAL 8
Farhan Ab Rahman
Conversion of data types in java
Conversion of data types in java
One97 Communications Limited
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
C++ Programming - 3rd Study
C++ Programming - 3rd Study
Chris Ohk
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
Hendromardikadorkdanbretastevanny.js
Hendromardikadorkdanbretastevanny.js
D Teb'scoca-colaspritefanta Colazero
Stl algorithm-Basic types
Stl algorithm-Basic types
mohamed sikander
Assignement c++
Assignement c++
Syed Umair
#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
Adamq0DJonese
Mais conteúdo relacionado
Mais procurados
week-5x
week-5x
KITE www.kitecolleges.com
Tower of HANOI
Tower of HANOI
Er. Ganesh Ram Suwal
C++ TUTORIAL 5
C++ TUTORIAL 5
Farhan Ab Rahman
TSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) Dropbox
Seb Sear
Freeing Tower Bridge
Freeing Tower Bridge
Dave Cross
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
C++ TUTORIAL 1
C++ TUTORIAL 1
Farhan Ab Rahman
C++ TUTORIAL 4
C++ TUTORIAL 4
Farhan Ab Rahman
Cpp programs
Cpp programs
harman kaur
Ct es past_present_future_nycpgday_20130322
Ct es past_present_future_nycpgday_20130322
David Fetter
C++ TUTORIAL 8
C++ TUTORIAL 8
Farhan Ab Rahman
Conversion of data types in java
Conversion of data types in java
One97 Communications Limited
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
C++ Programming - 3rd Study
C++ Programming - 3rd Study
Chris Ohk
Pratik Bakane C++
Pratik Bakane C++
pratikbakane
Hendromardikadorkdanbretastevanny.js
Hendromardikadorkdanbretastevanny.js
D Teb'scoca-colaspritefanta Colazero
Stl algorithm-Basic types
Stl algorithm-Basic types
mohamed sikander
Assignement c++
Assignement c++
Syed Umair
Mais procurados
(20)
week-5x
week-5x
Tower of HANOI
Tower of HANOI
C++ TUTORIAL 5
C++ TUTORIAL 5
TSP algorithm (Computational Thinking) Dropbox
TSP algorithm (Computational Thinking) Dropbox
Freeing Tower Bridge
Freeing Tower Bridge
Pratik Bakane C++
Pratik Bakane C++
C++ TUTORIAL 1
C++ TUTORIAL 1
C++ TUTORIAL 4
C++ TUTORIAL 4
Cpp programs
Cpp programs
Ct es past_present_future_nycpgday_20130322
Ct es past_present_future_nycpgday_20130322
C++ TUTORIAL 8
C++ TUTORIAL 8
Conversion of data types in java
Conversion of data types in java
Pratik Bakane C++
Pratik Bakane C++
Pratik Bakane C++
Pratik Bakane C++
Pratik Bakane C++
Pratik Bakane C++
C++ Programming - 3rd Study
C++ Programming - 3rd Study
Pratik Bakane C++
Pratik Bakane C++
Hendromardikadorkdanbretastevanny.js
Hendromardikadorkdanbretastevanny.js
Stl algorithm-Basic types
Stl algorithm-Basic types
Assignement c++
Assignement c++
Semelhante a 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
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
Adamq0DJonese
Data 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.pdf
forladies
CPP Homework Help
CPP Homework Help
C++ Homework Help
Implementing Software Machines in Go and C
Implementing Software Machines in Go and C
Eleanor McHugh
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
pasqualealvarez467
Program of sorting using shell sort #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
anujmkt
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.pdf
aryan9007
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.pdf
feelinggift
VTU Data Structures Lab Manual
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
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.pdf
amarnathmahajansport
Scala 2 + 2 > 4
Scala 2 + 2 > 4
Emil Vladev
4 operators, expressions & statements
4 operators, expressions & statements
MomenMostafa
Dsprograms(2nd cse)
Dsprograms(2nd cse)
Pradeep Kumar Reddy Reddy
Microsoft Word Hw#1
Microsoft Word Hw#1
kkkseld
Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha
Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha
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.pdf
kostikjaylonshaewe47
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
apleather
Semelhante a 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
-- 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.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.pdf
CPP Homework Help
CPP Homework Help
Implementing Software Machines in Go and C
Implementing Software Machines in Go and C
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
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.pdf
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.pdf
VTU Data Structures Lab Manual
VTU Data Structures Lab Manual
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.pdf
Scala 2 + 2 > 4
Scala 2 + 2 > 4
4 operators, expressions & statements
4 operators, expressions & statements
Dsprograms(2nd cse)
Dsprograms(2nd cse)
Microsoft Word Hw#1
Microsoft Word Hw#1
Bti1022 lab sheet 8
Bti1022 lab sheet 8
Bti1022 lab sheet 8
Bti1022 lab sheet 8
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.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
#include stdio.h#include stdlib.h#include string.h#inclu.pdf
Mais de 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)
kinan keshkeh
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...
kinan keshkeh
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
kinan keshkeh
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
kinan keshkeh
2Bytesprog2 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 list
kinan keshkeh
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
kinan keshkeh
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles
kinan keshkeh
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles
kinan keshkeh
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records
kinan keshkeh
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
kinan keshkeh
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism
kinan keshkeh
2 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
kinan keshkeh
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
kinan keshkeh
Mais de 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)
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...
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism
2 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_c9_ pointers and dynamic arrays
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
Último
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
shikhaohhpro
Software Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
Arshad QA
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
aagamshah0812
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
ComplianceQuest1
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
software pro Development
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
Delhi Call girls
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
SolGuruz
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
Mind IT Systems
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
AmarnathKambale
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
Fatema Valibhai
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
harshavardhanraghave
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
proinshot.com
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
HimanshiGarg82
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Steffen Staab
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
kalichargn70th171
Último
(20)
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
Software Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
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.
الكود : #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* ¤t,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");
Baixar agora