Skip to main content

Re: ::: vuaskari.com ::: cs 201

#include <iostream.h>
#include<conio.h>
#include <string>
using namespace std;

void sortMyArray(int arr[], int size);
void swapMyNumbers(int& x, int& y);

int main(){
//first array
int A[3][3],B[3][3],counter = 0,result[18];
string container = "";
char holder;

// first matrix input
cout << "Please enter the Elements of First Matrix:";
cin >> container;


for (int i = 0; i < 3 ; i++){

for (int j = 0; j < 3 ; j++){


holder = container[counter];

A[i][j] = atoi( &holder );

counter++;
}

}
//end of first part
container = "";
counter = 0;
cout << "Please enter the Elements of Second Matrix:";
cin >> container;

for (int i = 0; i < 3 ; i++){

for (int j = 0; j < 3 ; j++){

holder = container[counter];

B[i][j] = atoi( &holder );
counter++;
}

}
//end of second part

//storing first 2dimensioal array into single dimensional array

counter = 0;

for (int i = 0; i < 3 ; i++){

for (int j = 0; j < 3 ; j++){
result[counter] = A[i][j];

counter++;
}

}

//appending second 2dimensioal array into single dimensional array

counter = 9;

for (int i = 0; i < 3 ; i++){

for (int j = 0; j < 3 ; j++){
result[counter] = B[i][j];

counter++;
}

}


//sorting in DESC order i used bubble sort tech here



//out put
sortMyArray(result, 18);

for (int z = 0; z < 18 ; z++){
cout << " " <<result[z];
}
cout << "\n";

system("pause");
return 0;
}

void sortMyArray(int arr[], int size)
{
int last = size - 2;
int isChanged = 1;

while (last >= 0 && isChanged)
{
isChanged = 0;

for (int k = 0; k <= last; k++)
if (arr[k] < arr[k+1])
{
swapMyNumbers(arr[k], arr[k+1]);
isChanged = 1;
}
last--;
}
}

void swapMyNumbers(int& x, int& y)
{
int temp;
temp = x;
x = y;
y = temp;
}



your solution is wrong. miss madiha. see attachment for right one

On Mon, May 2, 2011 at 1:30 PM, Madiha Malik <mc110203633@vu.edu.pk> wrote:
here is cs201
 
 
#include<iostream.h>
#include<conio.h>
main()

{
 int arry1[3][3],arry2[3][3],arry[18],index,temp,max;
 cout<<"Please enter the Elements of 1st Matrix: ";
 for(int e=0;e<3;e++)
 {
         for(int m=0;m<3;m++)
         {
                 cin>>arry1[e][m];
         }
 }
cout<<"Please enter the Elements of 2nd Matrix: ";
 for(int e=0;e<3;e++)
 {
         for(int m=0;m<3;m++)
         {
                 cin>>arry2[e][m];
         }
 }
 index=0;
 for(int e=0;e<3;e++)
 {
         for(int m=0;m<3;m++)
         {
                 arry[index]=arry1[e][m];
                 index++;
         }
 }
 index=9;
 for(int e=0;e<3;e++)
 {
         for(int m=0;m<3;m++)
         {
                 arry[index]=arry2[e][m];
                 index++;
         }
 }
 for(int e=0;e<18;e++)
 {
         for(int m=e;m<18;m++)
         {
                 if(arry[e]<arry[m])
                 {            
                          temp=arry[e];
                          arry[e]=arry[m];
                          arry[m]=temp;
                 }
         }

 }

cout<<"Sorted Values from Both the Matrices are: "<<endl;
for(int e=0;e<18;e++)
{
        cout<<arry[e]<<" ";
}
getch();
}


On Mon, May 2, 2011 at 1:00 AM, mc110201340 Asaf Faiz <mc110201340@vu.edu.pk> wrote:
plzzzzzz send me solution of cs201  2nd    assignment ,,,,plzzzzzzzzzz send i will submit it after making a lot of changes so plzzzzzzzzzzzzzzzzzzzzzzzzz send now



On Fri, Apr 29, 2011 at 10:24 PM, mc110201752 Ayesha Quddoos <mc110201752@vu.edu.pk> wrote:
kb tak upload kerni hai assignment 2nd for cs201..plz guide me:( matrix aata hai bt in c how will make programme plz plzzzzz guide me

On Fri, Apr 29, 2011 at 9:06 PM, mc100400213 Sharjeel Anjum <mc100400213@vu.edu.pk> wrote:
Abi nai bani cs201, or cs 601 ki......wait guys for 24 hours

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en



--





Man said to ALLAH"i hate life"

ALLAH replied "who asked u to love life just love me the life will be beautiful" 



MCS First Semister
Skype : MADIHA  (from kamra)


--



--
Regards
Imran bashir

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en

Comments

Popular posts from this blog

Re: )))))))Vu & Company((((((( : Amazing Art on Human Faces

wao great.  On Mon, Dec 13, 2010 at 5:12 PM, Muhammad Ilyas < mmilyaskhan@gmail.com > wrote:     Amazing Art on Human Faces                           -- BEST REGARDS Muhammad Ilyas   . .*) .*) ..*) .*) (. (.` * '...**,''',...LOVE PAKISTAN...... ******************************** -- You received this message because you are subscribed to the Google Groups "Vu and Company" group. To post to this group, send email to vu-and-company@googlegroups.com . To unsubscribe from this group, send email to vu-and-company+unsubscribe@googlegroups.com . For more options, visit this group at http://groups.google.com/group/vu-and-company?hl=en . -- You received this message because you are subscribed to the Google Groups "Vu and Company" group. To post to ...

::: vuaskari.com ::: Office of the High Commissioner for Human Rights: URGENT PETITION ON THE UN KASHMIR REPORT

Hey, I just signed the petition "Office of the High Commissioner for Human Rights: URGENT PETITION ON THE UN KASHMIR REPORT" and wanted to see if you could help by adding your name. Our goal is to reach 200,000 signatures and we need more support. You can read more and sign the petition here: http://chng.it/WMsBWWXBd6 Thanks! khurram -- We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com, To post to this group, send email to vuaskari_com@googlegroups.com Visit these groups: This (Main) Group: http://groups.google.com/group/vuaskari_com?hl=en?hl=en MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en Management: https://groups.google.com/group/vuaskari_mgt?hl=en Marketing: https://groups.google.com/group/vuaskari_mkt?hl=e...

[vu-students] [**Virtual University Of Pakistan**Student Cafe] [~>VU-P!nD!<~] FIN630 Quiz Investment Analysis & Portfolio Management

FIN630 Quiz Investment Analysis & Portfolio Management http://pakitworld.board-directory.com/t192-fin630-quiz-investment-analysis-portfolio-management#192 -- You received this message because you are subscribed to the Google Groups "vupindi" group. To post to this group, send email to vupindi@googlegroups.com To unsubscribe from this group, send email to vupindi+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/vupindi?hl=en -- Posted By Sheroo to **Virtual University Of Pakistan**Student Cafe at 11/20/2011 11:18:00 AM -- You received this message because you are subscribed to the Google Groups "VU Students" group. To post to this group, send email to vu-students@googlegroups.com To unsubscribe from this group, send email to vu-students+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/vu-students?hl=en_PK?hl=en