Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. const int dimMax=100;
  4. void afisare(double v[dimMax], int n){
  5.     for(int i=0; i<n; i++)
  6.         cout<<v[i]<<' ';
  7.     cout<<endl;
  8. }
  9. void schimb( int a[dimMax][dimMax], double v[dimMax], int n, int i){
  10.     for(int j=0; j<n; j++){
  11.         v[j]=a[i][j];
  12.     }
  13. }
  14. bool areEgale(int a[dimMax][dimMax], int n){
  15.     for(int i=0; i<n; i++){
  16.         double linie[dimMax];
  17.         schimb(a, linie, n, i);
  18.         afisare(linie, n);
  19.         for(int j=i+1; j<n; j++){
  20.             double flotant[dimMax];
  21.             schimb(a, flotant, n, j);
  22.             bool egale=true;
  23.             for(int k=0; k<n; k++){
  24.                 bool gasit=false;
  25.                 for(int t=0; t<n; t++){
  26.                     if(linie[k]==flotant[t]){
  27.                         gasit=true;
  28.                         flotant[t]=0.5;
  29.                         break;
  30.                     }
  31.                 }
  32.                 if(gasit!=true) egale=false;
  33.             }
  34.             if(egale==true) return true;
  35.         }
  36.     }
  37.             return false;
  38. }
  39. int main(){
  40.     int a[dimMax][dimMax]={{1,3,3},{4,3,5},{3,1,3}};
  41.     cout<<areEgale(a, 3)<<endl;
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement