:care حل شدہ اسائنمنٹس ڈانلوڈ کرنے کے لئے پہلے رجسڑ کریں شکریہ :care

How write Program 3x3 Matrices Elements Entry Code in C++

This Section is For Vu Old Solved Assignments From Instructors which will be help full for you finding your Solution.
Forum rules
Post Only Old Assignments Which are Solved By Instructors Thanks
User avatar
SHΛЯP SHӨӨƬΣЯ
★★★★★★★★★★★★★
★★★★★★★★★★★★★
Posts: 196
Joined: Fri Dec 22, 2017 8:10 am
Location: Lahore
Contact:
Status: Offline

How write Program 3x3 Matrices Elements Entry Code in C++

Post by SHΛЯP SHӨӨƬΣЯ »

For C++ Programmers or Students May Be My This Code got 20/20 Marks From Dr.Naveed A Malik Help Full in Matrices Problem Solving Question or Assignments Download Attachment for exe file and Code of C++ is Also given .
 // Dear sir My Roll No: Mc100400117 Name Ali Raza
#include<iostream.h>
main()

 
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
 
     
     
        //declaration of arrayes and variables used in the programme.
     
      int A[3][3],B[3][3],c[17];   
      int i=0,col,row,rowsize=3,colsize=3,temp,k; 
     
     
      //Give The title to the programme
      
      cout<<endl;cout<<"\t"<<"Assingment No 2:Introduction to Programming"<<endl;
      cout<<"        *******************************************";
      cout<<endl;
      cout<<endl;
      cout<<endl;
     
      cout<<"The Elements of Matrix A:"<<endl<<endl;
      //prompt the user to get Elements of the Matix A
     
      for(row=0;row<rowsize;row++){
      for(col=0;col<colsize;col++){
                                  cout<<"Enter the element ["<<row<<","<<col<<"]=";
                                                              cin>>A[row][col];}
      //storing A[row][col] in to the array C
      if(A[0][0]){c[0]=A[0][0];}
      if(A[0][1]){c[1]=A[0][1];}
      if(A[0][2]){c[2]=A[0][2];}
      if(A[1][0]){c[3]=A[1][0];}
      if(A[1][1]){c[4]=A[1][1];}
      if(A[1][2]){c[5]=A[1][2];}
      if(A[2][0]){c[6]=A[2][0];}
      if(A[2][1]){c[7]=A[2][1];}
      if(A[2][2]){c[8]=A[2][2];}
     
     
}
    
     
      //developing space in the programme To Make it Beautiful
      cout<<endl<<endl<<endl;
     
    
     //Printing of Martix A on the screen
    
      cout<<"The Matrix A is Given:"<<endl;cout<<endl;
 
      for(row=0;row<rowsize;row++){
      for(col=0;col<colsize;col++){
      cout<<"\t"<<A[row][col];
      }
     
      //developing space in the programme To Make it Beautiful
      cout<<endl;}cout<<endl;
     
     
      //prompt the user to get Elements of the Matix A
      cout<<"The Elements of Matrix B:"<<endl<<endl;
 
      for(row=0;row<rowsize;row++){
      for(col=0;col<colsize;col++){
                                 cout<<"Enter the element ["<<row<<","<<col<<"]=";
                                                       cin>>B[row][col];}
                                                  
      if(B[0][0]){c[9]=B[0][0];}
      if(B[0][1]){c[10]=B[0][1];}
      if(B[0][2]){c[11]=B[0][2];}
      if(B[1][0]){c[12]=B[1][0];}
      if(B[1][1]){c[13]=B[1][1];}
      if(B[1][2]){c[14]=B[1][2];}
      if(B[2][0]){c[15]=B[2][0];}
      if(B[2][1]){c[16]=B[2][1];}
      if(B[2][2]){c[17]=B[2][2];}
   
   
}
   
     
     
      cout<<endl<<endl<<endl;
    
    
      //Printing of Martix B on the screen
      cout<<"The Matrix B is Given:"<<endl;cout<<endl;
      for(row=0;row<rowsize;row++){
      for(col=0;col<colsize;col++){
                                  cout<<"\t"<<B[row][col];
                                           }cout<<endl;}
cout<<endl;
//arranging the elements portion     
cout<<"The Arranged Matrix Elements are Given:";
cout<<endl;
cout<<endl;
cout<<"************************************************************";cout<<endl; 
 
  //sorting code for the arranging elements of the arry c
  for(k=0;k<10000;k++){
                      for(i=0;i<16;i++){
                                        if(c<c[i+1]){
                                                        temp=c[i+1];
                                                        c[i+1]=c;
                                                       c=temp;}}}
  //printing result on the screen
    for(i=0;i<17;i++){
cout<<c;cout<<"\t";}
 
 
 
 
 
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
 
}
     
 
     
 
 
Image

User avatar
Aliya Khan
***New Member***
***New Member***
Posts: 6
Joined: Mon Aug 03, 2020 8:12 pm
Status: Offline

Re: How write Program 3x3 Matrices Elements Entry Code in C++

Post by Aliya Khan »

Thank you so much

Post Reply

Last 10 Members Who Visited This Topic

User avatar Aliya Khan (2), User avatar SHΛЯP SHӨӨƬΣЯ (3)

Who is online

Users browsing this forum: No registered users and 0 guests