Advertisement
Guest User

Untitled

a guest
May 5th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {int w,k,i,j;
  8.  
  9.  cout<<"ile wierszy ma miec Twoja macierz?"<<endl;
  10.  cin>>w;
  11.  cout<<"Ile kolumny ma miec Twoja macierz?"<<endl;
  12.  cin>>k;
  13.  
  14.  int macierza[w][k];
  15.  int macierzb[w][k];
  16.  int macierzc[w][k];
  17.  
  18.  
  19.  
  20.  cout<<"Podaj elementy macierzy A : ";
  21.  cout<<" "<<endl;
  22.  
  23.            
  24.           for(i=0; i<w; i++)
  25.             for(j=0; j<k; j++)    
  26.         cin>>macierza[i][j];
  27.         cout<<" \n\n";
  28.        
  29.         for(i=0; i<w; i++){
  30.               {
  31.               for(j=0; j<k; j++)
  32.                        cout<<macierza[i][j];
  33.               }
  34.               cout<<""<<endl;}
  35.              
  36.  cout<<"Podaj elementy macierzy B : ";
  37.  cout<<" "<<endl;
  38.  
  39.            
  40.           for(i=0; i<w; i++)
  41.             for(j=0; j<k; j++)    
  42.         cin>>macierzb[i][j];
  43.         cout<<" \n\n";
  44.        
  45.         for(i=0; i<w; i++){
  46.               {
  47.               for(j=0; j<k; j++)
  48.                        cout<<macierzb[i][j];
  49.               }
  50.               cout<<""<<endl;}
  51.              
  52. for(int i=0;i<w;i++)
  53.     {
  54.       for(int j=0;j<k;j++)
  55.       {
  56.               macierzc[i][j] = macierza[i][j] + macierzb[i][j];
  57.               cout<<macierzc[i][j]<<" ";
  58.       }
  59.       cout<<endl;     }
  60.              
  61.              
  62.              
  63.              
  64.              
  65.      
  66.    
  67.     system("Pause");
  68.     return EXIT_SUCCESS;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement