Guest User

Untitled

a guest
Jan 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  
  4. void main () {
  5.     int matrice1[100][100], matrice2[100][100], R, C, i, j;
  6.     cout <<"Quante righe devono avere le matrici?"<<endl;
  7.     cin >> R;
  8.     cout <<"Quante colonne devono avere le metrici?"<<endl;
  9.     cin >> C;
  10.     for (i=0;i<R;i++) {
  11.         for (j=0;j<C;j++) {
  12.             cout <<"Inserisci un elemento nella matrice 1."<<endl;
  13.             cin >> matrice1[i][j];
  14.         }
  15.     }
  16.     for (i=0;i<R;i++) {
  17.         for (j=0;j<C;j++) {
  18.             cout <<"Inserisci un elemento nella matrice 2."<<endl;
  19.             cin >> matrice2[i][j];
  20.         }
  21.     }
  22.     for (i=0;i<R;i++) {
  23.         for (j=0;j<C;j++) {
  24.             if (matrice1[i][j]==matrice2[i][j])
  25.                 cout <<"L'elemento uguale è "<<matrice1[i][j]<<". L'elemento si trova nella posizione riga: "<<i<<" colonna: "<<j<<endl;
  26.         }
  27.     }
  28.     getch ();
  29.     return;
  30. }
Add Comment
Please, Sign In to add comment