Advertisement
Guest User

123

a guest
Dec 12th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C++ Compiler.
  4. Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10. #include <cstdlib>
  11. #include <ctime>
  12. using namespace std;
  13.  
  14. int main()
  15. {
  16.  
  17. //srand(time(NULL));
  18.  
  19. int N;
  20. cout<<"Введите размер массива(N<=6):";
  21. int A[5];
  22.  
  23. cout<<"привет";
  24. for(int i=0; i<5; i++){
  25. A[i]=rand()%20;
  26. }
  27. //cout<<""
  28. cout<<"Вот ваш массив:";
  29. for(int i=0; i<5; i++){
  30. cout<<A[i];
  31. }
  32.  
  33. for(int i=0; i<=5-1;i++){
  34. for(int j=0; j<i; i++){
  35. if(A[j]>A[j+1]){
  36. int tmp= A[j];
  37. A[i]=A[j+1];
  38. A[j+1]=tmp;
  39. cout<<A[j];
  40. }
  41.  
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement