Thursday, March 12, 2009

[Cpp-Programming] help

is this 2 program code right of two matrix addition

1st program

#include<iostream.h>
#define row 4
#define col 4

int main()
{
int i[row][col],j[row][col],k[row][col];
int a,b,c,d,e,f,g,h;

for(a=0;a<row-1;a++)
{ cout<<"\n";
for(b=0;b<col-1;b++)
cin>>i[a][b];
}
for(a=0;a<row-1;a++)
{ cout<<"\n";
for(b=0;b<col-1;b++)
cin>>j[a][b];
}

for(a=0;a<row-1;a++)
{ cout<<"\n";
for(b=0;b<col-1;b++)
k[a][b]= j[a][b]+i[a][b]; }


for(a=0;a<row-1;a++)
{cout<<"\n";
for(b=0;b<col-1;b++)
cout<<"\t";
cout<<k[a][b];}

system("pause"); }

2nd program


#include<iostream.h>


int main()
{
int i[10][10],j[10][10],k[10][10];
int a,b,c,d,e,f;
cin>>c>>d;
cin>>e>>f;
for(a=0;a<c;a++)
{ cout<<"\n";
for(b=0;b<d;b++)
cin>>i[a][b];
}
for(a=0;a<e;a++)
{ cout<<"\n";
for(b=0;b<f;b++)
cin>>j[a][b];
}

for(a=0;a<c;a++)
{ cout<<"\n";
for(b=0;b<d;b++)
k[a][b]= j[a][b]+i[a][b]; }


for(a=0;a<c;a++)
{cout<<"\n";
for(b=0;b<d;b++)
cout<<"\t";
cout<<k[a][b];}

system("pause"); }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

<< Home