Matrix print

  • 200 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
200
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. REPUBLIC OF THE PHILIPPINES LAGUNA STATE POLYTECHNIC UNIVERSITY SINILOAN HOST CAMPUS SINILOAN LAGUNA SUBMITTED BY : SOFIA D. PALAWAN KARA CRYSTAL R. PASCASIO SUBMITTED TO : MS AILEEN MAGTIBAY AIT 2-1
  • 2. ANALYSIS FOR MATRIX ADDITION PROGRAMMING is the art of making a computer do what you want it to do. At the very simplest level it consists of issuing a sequence of commands to a computer to achieve an objective. A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal. Each language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions. Computer Programming PURPOSE OF PROGRAMMING FOR MATRIX Their purpose is to police the system and terminate any entity that may threaten the stability or function of the Matrix, such as Red pills and Exiled programs. EXPLANATION FOR MATRIX ADDITION In matrix addition, these programs you should notice the branch construction which follows the size statements. This is included as an error message. In the case of add, an error is made if we attempt to add matrices of different sizes. The words surrounded by the quotes will be treated as text and sent to the screen as the value of the variable. Following the message is the command return, which is the directive to send the control back to the function which called add or return to the prompt. I usually only recommend using the return command in the context of an error message.
  • 3. #include<iostream> using namespace std; int main() { int i,j,m1,m2,n1,n2; int a[10][10], b[10][10], c[10] [10]; cout<<"Enter row of matrix A: "; cin>>m1; cout<<"Enter column of matrix A: "; cin>>n1; cout<<"Enter row of matrix B: "; cin>>m2; cout<<"Enter column of matrix B: "; cin>>n2; if (m1!=m2 && n1!=n2) { cout<<"Both the matrices should be of same order"; } else{ cout<<"Enter elements of matrix A["<<m1<<"] ["<<n1<<"]"<<endl; for (i=0 ; i<m1 ; i++) { for (j=0 ; j<n1 ; j++) cin>>a[i][j]; } cout<<"Enter elements of matrix B["<<m2<<"] ["<<n2<<"]"<<endl; for (i=0 ; i<m2 ; i++) { for (j=0 ; j<n2 ; j++) cin>>b[i][j]; } for (i=0 ; i<m1 ; i++) { for (j=0 ; j<n2 ; j++) c[i][j]=a[i][j]+b[i][j]; } cout<<"Addition of matrices A and B"; for(i=0 ; i<m1 ; i++) { cout<<endl; for(j=0 ; j<n2 ; j++) cout<<c[i][j]<<" "; }} cout<<endl; system("pause"); return 0; } OUTPUT OF MATRIX ADDITION