Add to Favorites    Make Home Page 4771 Online  
 Language Categories  
 Our Services  

Home » C++ Home » Beginners / Lab Assignments Home » A simple matrix software

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title A simple matrix software
Author satish kumar
Author Email satish_eck04 [at] yahoo.co.in
Description This is a program of matrix capable of doing several works
with two matrices. It can add, subtract, multiply of two matrices and
if
user wants to see the input entered in two matrices he can also see. It
provides the facility to user to do again some work on another matrix
without running the program twice.
Category C++ » Beginners / Lab Assignments
Hits 371501
Code Select and Copy the Code
Code : #include<iostream.h> #include<conio.h> #include<iomanip.h> #include<process.h> #define sk 100 class matrix { public: int i,j,k,sum,r1,r2,c1,c2; int m1[sk][sk],m2[sk][sk]; char reply; void getin(void); void mply(void); void add(void); void minus(void); void read(void); void input(void); }; void matrix::getin() { cout<<" WELCOME TO SOLUTION OF TWO MATRICRES "; cout<<" -------------------------------------"; cout<<" PROGRAMMED BY : * SATISH KUMAR * "; cout<<" --------------------------------"; cout<<" YOU CAN CALCULATE UPTO A LIMIT OF MATRIX 100 * 100 "; cout<<" YOU CAN DO THE FOLLOWING : ADDITION SUBTRACTION "; cout<<" MULTIPLICATION AND READ ONLY "; cout<<" DO YOU WANT TO CONTINUE [Y/N] : "; cin >>reply; if(reply=='y'||reply=='Y') { cout<<" Enter the number of rows and columns of matrix 1 : "; cin>>r1>>c1; cout<<" Enter the value of matrix 1 : "<<endl; for(i=0;i<r1;i++) for(j=0;j<c1;j++) cin>>m1[i][j]; cout<<" Enter the number of rows and columns of matrix 2 : "; cin>>r2>>c2; cout<<" Enter the value of matrix 2 : "<<endl; for(i=0;i<r2;i++) for(j=0;j<c2;j++) cin>>m2[i][j]; } else exit(0); } void matrix::mply() { cout<<" THE RESULT AFTER MULTIPLICATION IS : "; if(c1==r2) { for(i=0;i<r1;i++) { cout<<endl; for(j=0;j<c2;j++) { sum=0; for(k=0;k<c1;k++) sum+=m1[i][k]*m2[k][j]; cout<<setw(6)<<sum; } } } else { cout<<" INVALID INPUT "; cout<<" MULTIPLICATION NOT POSSIBLE "; } } void matrix::add() { cout<<" THE RESULT AFTER ADDITION IS : "; if(r1==r2&&c1==c2) { for(i=0;i<r1;i++) { cout<<endl; for(j=0;j<c1;j++) cout<<setw(3)<<(m1[i][j]+m2[i][j]); } } else { cout<<" INVALID INPUT "; cout<<" ADDITION NOT POSIIBLE "; } } void matrix::minus() { cout<<" THE RESULT AFTER SUBTRACTION IS : "; if(r1==r2&&c1==c2) { for(i=0;i<r1;i++) { cout<<endl; for(j=0;j<c1;j++) cout<<setw(3)<<(m1[i][j]-m2[i][j]); } } else { cout<<" INVALID INPUT "; cout<<" SUBTRACTION NOT POSSIBLE "; } } void matrix::read() { cout<<" ENTERED MATRIX 1 IS : "; for(i=0;i<r1;i++) { cout<<endl; for(j=0;j<c1;j++) cout<<setw(3)<<m1[i][j]; } cout<<endl; cout<<" ENTERED MATRIX 2 IS : "; for(i=0;i<r2;i++) { cout<<endl; for(j=0;j<c2;j++) cout<<setw(3)<<m2[i][j]; } } void main() { int ans,option; char response; matrix m; clrscr(); start : m.getin(); again : cout<<" What you wish to do : "<<endl; cout<<" 1.ADDITION "; cout<<" 2.SUBTRACTION "; cout<<" 3.MULTIPLY "; cout<<" 4.READ ONLY "; cout<<" 5.EXIT "; cout<<" ENTER YOUR CHOICE IN NUMBERS : "; repeat : cin>>ans; switch(ans) { case 1 : m.add(); break; case 2 : m.minus(); break; case 3 : m.mply(); break; case 4 : m.read(); break; case 5 : goto exit ; default : { cout<<" INVALID ENTRY ENTER YOUR CHOICE AGAIN : "; goto repeat; } } cout<<" DO YOU WANT TO DO IT FOR ANOTHER TIME [Y/N] : "; cin>>response; if(response=='y'||response=='Y') { wrong: cout<<" Enter your choice in number "; cout<<" 1.FOR Same matrix 2.FOR Another matrix "; cin>>option; switch(option) { case 1 : goto again; case 2 : goto start; default: cout<<" INVALID ENTRY "; goto wrong; } } exit : getch(); }

Related Source Codes

Script Name Author
Moving ball screen saver karlmarx
The Classic Game of Snake & Ladder Lakshmi Narayana .A
Railway seat reservation question which comes in sapient VyomWorld
To calculate percentile Ravi Mathur
Send to folder ANIMESH SAHU
Analog clock and calendar Nazia & Rida
HIGH/LOW GAME MOLLY ARORA
Data structure (stack Implimentation) Swapnil B Adsure
Memory Game AnirudhSanyal
Easy Calc Anirudh Sanyal
GK Quiz Anirudh Sanyal
Hangman Game Manish Jain
Snakeman Manish Jain
Full month Calendar Nigi
Cursor shapes nigi

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=1015


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review