Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4.  
  5. int bubble_sort(int tab[],int size)
  6. {
  7. for(int i=0;i<size;i++){
  8. for(int j=1;j<size-i;j++){
  9. if(tab[j-1]>tab[j]){
  10. swap(tab[j-1], tab[j]);
  11. }
  12.  
  13. }
  14.  
  15. }
  16.  
  17. }
  18.  
  19. int main(){
  20.  
  21. const int size = 5;
  22. int tab[size];
  23. int tab1[size];
  24.  
  25.  
  26. for(int i=0;i<size;i++){
  27. cin>>tab[i];
  28. }
  29.  
  30. bubble_sort(tab,size);
  31.  
  32.  
  33. for(int i=0;i<size;i++){
  34. cin>>tab1[i];
  35. }
  36. bubble_sort(tab1,size);
  37.  
  38.  
  39.  
  40.  
  41. int x = 0;
  42. for(int i=0;i<5;i++){
  43. if(tab[i] == tab1[i]){
  44. x = x + 1 ;
  45. }
  46.  
  47. }
  48.  
  49. if(x == 5){
  50. cout << "Equal." ;
  51. }
  52. else{
  53. cout << "Different";
  54. }
  55.  
  56.  
  57.  
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement