Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- //srand(time(NULL));
- int N;
- cout<<"Введите размер массива(N<=6):";
- int A[5];
- cout<<"привет";
- for(int i=0; i<5; i++){
- A[i]=rand()%20;
- }
- //cout<<""
- cout<<"Вот ваш массив:";
- for(int i=0; i<5; i++){
- cout<<A[i];
- }
- for(int i=0; i<=5-1;i++){
- for(int j=0; j<i; i++){
- if(A[j]>A[j+1]){
- int tmp= A[j];
- A[i]=A[j+1];
- A[j+1]=tmp;
- cout<<A[j];
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement