- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
const int n=20;
int mass[20];
void massiv(int x[])
{
srand(time(NULL));
for(int i=0;i<20;i++) mass[i]=rand()%100;
return 0;
}
void vivod(int x[])
{
for(int i=0;i<20;i++) cout<<mas[i]<<"\n";
return 0;
}
void sort (int x[])
{
int i,j,b;
for(j=1;j<=n-1;j++)
for(i=0;i<=n-1-j;i++)
if (mass[i]>mass[i+1])
{
b=mass[i];
mass[i]=mass[i+1];
mass[i+1]=b;
}
}
return 0;
}
int main(int argc, char *argv[])
{
zapolneniemassiva(mass[20]);
pokaz(mass[20]);
sort(mass[20]);
variant3(mass[20]);
system("PAUSE");
return EXIT_SUCCESS;
}
Одногруппник сделал лабу на C++, программа сортирует массив по возрастанию и выводит, ну, по крайней мере, должна.