Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- const int dimMax=100;
- void afisare(double v[dimMax], int n){
- for(int i=0; i<n; i++)
- cout<<v[i]<<' ';
- cout<<endl;
- }
- void schimb( int a[dimMax][dimMax], double v[dimMax], int n, int i){
- for(int j=0; j<n; j++){
- v[j]=a[i][j];
- }
- }
- bool areEgale(int a[dimMax][dimMax], int n){
- for(int i=0; i<n; i++){
- double linie[dimMax];
- schimb(a, linie, n, i);
- afisare(linie, n);
- for(int j=i+1; j<n; j++){
- double flotant[dimMax];
- schimb(a, flotant, n, j);
- bool egale=true;
- for(int k=0; k<n; k++){
- bool gasit=false;
- for(int t=0; t<n; t++){
- if(linie[k]==flotant[t]){
- gasit=true;
- flotant[t]=0.5;
- break;
- }
- }
- if(gasit!=true) egale=false;
- }
- if(egale==true) return true;
- }
- }
- return false;
- }
- int main(){
- int a[dimMax][dimMax]={{1,3,3},{4,3,5},{3,1,3}};
- cout<<areEgale(a, 3)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement