04-27-2011, 06:24 PM
help urgently needed
|
CS 201 Assignment # 2 Solution idea Spring 2011
|
|
04-27-2011, 06:24 PM
help urgently needed
04-27-2011, 07:02 PM
oright. where is the assignment?
04-27-2011, 11:47 PM
welcome pari
04-29-2011, 09:32 PM
plz snd me solution
mileys3:
04-30-2011, 01:46 AM
prince g. i told you that it will be here. just wait. working dear. light nay buhat tang keya howa hai.
05-01-2011, 05:46 PM
[SIZE="6"]aslamo elakum bhai cs 201 ki asignment 2 man help chahye [/SIZE]
05-01-2011, 05:51 PM
kia help chaheya app ko?
05-01-2011, 11:41 PM
Dear Mr. Xpert, Solution required for CS201 Assignment # 2.
Thanks
05-02-2011, 02:32 AM
#include <iostream>
#include <iomanip> using namespace std; void fill(int[][3]); void print(int[][3]); void printa(int[]); void combine(int[][3],int[][3],int[]); int main() {int a[3][3],b[3][3],c[18]; cout"Matrix a\n"; fill(a); cout"Matrix b\n"; fill(b); cout"Matrix a\n"; print(a); cout"Matrix b\n"; print(b); combine(a,b,c); cout"The sorted merged array\n"; printa©; system("pause"); return 0; } void printa(int a[]) {int i; for(i=0;i<18;i++) coutsetw(4)a[i]; coutendl; } void fill(int a[][3]) {int i,j; cout"Enter the elements of the matrix :\n"; for(i=0;i<3;i++) for(j=0;j<3;j++) {cout"Enter element ["i"]["j"]: "; cin>>a[i][j]; } } void print(int a[][3]) {int i,j; for(i=0;i<3;i++) {for(j=0;j<3;j++) coutsetw(4)a[i][j]; cout"\n"; } cout"\n"; } void combine(int a[][3],int b[][3],int c[]) {bool atemp[3][3]={false}; bool btemp[3][3]={false}; int i,j,upto=0,it,jt,in,max; for(upto=0;upto<18;upto++) { max=-99999; for(i=0;i<3;i++) for(j=0;j<3;j++) if(!atemp[i][j]) if(a[i][j]>max) {max=a[i][j]; it=i; jt=j; in=0; } for(i=0;i<3;i++) for(j=0;j<3;j++) if(!btemp[i][j]) if(b[i][j]>max) {max=b[i][j]; it=i; jt=j; in=1; } c[upto]=max; if(in==0) atemp[it][jt]=true; else btemp[it][jt]=true; } } |
|
« Next Oldest | Next Newest »
|