Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
██▒▒▒▒█▒▒▒▒██(¯`•´¯)
▀██▒▒▒▒▒▒▒██▀.*•❀•*.
─▀██▒▒▒▒▒██▀.•..(¯`•´¯)
───▀██▒██▀(¯`•´¯)*•❀•*
─────▀█▀…•..*•❀•*
♥𝙖𝙙𝙙 𝙢𝙚 𝙥𝙡𝙚𝙖𝙨𝙚♥
......................./:.:.:.:.:.| +Rep
......................|;.;.;.;.;./ +Rep
......................|.;.;.;.;.| +Rep
............._,,,,,_.).;.;.;.;.| +Rep
.........,,-":.:.:.:."~-,;.;.;.| +Rep
........(_,,,,---,,_:.:.);.;.;..",, +Rep
......,-":.:.:.:.:.""-,,/;.;.;.;.;.", +Rep
.....(:.__,,,,,,,,,___);.;.;.;.;.;| +Rep
...../"":.:.:.:.:.:.:¯""\;.;.;.;.;.," +Rep
....\",__,,,,,,,,,,,__/;;;;;;;;;/\ +Rep
.....\.::.:.:.:.:.:.:.;.);;;;;;;;;/:\ +Rep
.......\,,,,,---~~~~;;;;;;;;,"::::\ +Rep
.........."""~~--,,,,,,,,,,-"::::::::::\ +Rep
...................\:::::::::::::::::::::::\+Rep
░░░░░░░░░░░░░░░░░░+Rep
░█▀▀ ░█▀█ ░█ ░█▀▀ ░░░░+Rep
░█▀▀ ░█▀▀ ░█ ░█ ░░░░░░░+Rep
░▀▀▀ ░▀ ░░░▀ ░▀▀▀ ░░░░░░+Rep
░░░░░░░░░░░░░░░░░░░░░░░ +Rep
#include <ctime>
using namespace std;
void BubbleSort(int* a, int n);
void MakeRandomMas(int* a, int n);
void PrintMas(int* a, int n);
int MaxItem(int* a, int n);
int main() {
int a[100], n;
cin >> n;
MakeRandomMas(a, n);
PrintMas(a, n);
BubbleSort(a, n);
PrintMas(a, n);
cout << MaxItem(a, n);
}
void BubbleSort(int* a, int n) {
int t;
for (int i = 0; i < n - 1; i++)
for (int j = n - 2; j >= i; j--)
if (a[j] > a[j + 1]) {
t = a[j];
a[j] = a[j + 1];
a[j + 1] = t;
}
}
void MakeRandomMas(int* a, int n) {
srand(time(NULL));
for (int i = 0; i < n; i++)
a = rand() % 100;
}
void PrintMas(int* a, int n) {
for (int i = 0; i < n; i++)
cout << a << " ";
cout << endl;
}
int MaxItem(int* a, int n) {
int t = a[0], max=-10000;
for (int i = 1; i < n; i++) {
if (t == a && max < a ) {
max = a ;
}
t = a ;
}
return max;
}