Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void g(int *A, int *B, int lim1, int lim2, int lim3, int lim4, int &i, int&j, int&k, int&h, int&lung)
- { int q=0, s=0, t=0, v=0, currentlength=0;
- i=j=k=h=lung=0;
- for(int a =0; a < lim1; a++)
- { for(int b =0; b < lim2; b++)
- { for(int c =0; c < lim3; c++)
- { for(int d =0; d < lim4; d++)
- if((*(A + (a*(lim2*lim3*lim4)) + (b*(lim3*lim4)) + (c*(lim4)) + d)) == (*(B + (a*(lim2*lim3*lim4)) + (b*(lim3*lim4)) + (c*(lim4)) + d)))
- { cout << (*(A + (a*(lim2*lim3*lim4)) + (b*(lim3*lim4)) + (c*(lim4)) + d)) << " " << (*(B + (a*(lim2*lim3*lim4)) + (b*(lim3*lim4)) + (c*(lim4)) + d));
- if(a==lim1-1&&b==lim2-1&&c==lim3-1&&d==lim4-1)
- { if(currentlength > lung)
- { i=q; j=s; k=t; h=v;
- lung = currentlength;
- currentlength=0;
- }
- }
- else{ currentlength++; cout << " qui ho incrementato" << endl;
- if(currentlength==0)
- q=a; s=b;t=c; v=d;
- }
- }
- else
- { cout << (*(A + (a*(lim2*lim3*lim4)) + (b*(lim3*lim4)) + (c*(lim4)) + d)) << " " << (*(B + (a*(lim2*lim3*lim4)) + (b*(lim3*lim4)) + (c*(lim4)) + d));
- if(currentlength > lung)
- { i=q; j=s; k=t; h=v;
- lung = currentlength; cout << "Qui ho scambiato e azzerato " << endl;
- currentlength=0;
- }
- else currentlength=0; cout << "Qui ho azzerato " << endl;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement