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

Vu Old Solved Programming Based Assignments Codes are Available in this Section.
Post Reply
User avatar
ALI RAZA
★★★★★★★★★★★★★
★★★★★★★★★★★★★
Posts: 177
Joined: Fri Dec 22, 2017 8:10 am
Location: Lahore
Has thanked: 6 times
Been thanked: 7 times
Contact:
Status: Offline

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

Post by ALI RAZA » Fri Aug 31, 2018 9:21 am

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 .

Code: Select all

// Dear sir My Roll No: Mc100400117 Name Ali Raza



[img]http://www.vusociety.com/ext/dmzx/imageupload/files/45811e11b1edb8037f08dcc7ac95492a.png[/img]



#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[i]
      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[i]
  for(k=0;k<10000;k++){
                      for(i=0;i<16;i++){
                                        if(c[i]<c[i+1]){
                                                        temp=c[i+1];
                                                        c[i+1]=c[i];
                                                       c[i]=temp;}}}
  //printing result on the screen
    for(i=0;i<17;i++){
cout<<c[i];cout<<"\t";}
 
 
 
 

cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
cout<<endl;cout<<endl;
 
}
      

      
  

Download rar file unrar and get exe file of above code run and Test .



Post Reply

Last 10 Members Who Visited This Topic

  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest