Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <stdio.h>
- #include <string>
- #include <conio.h>
- #include <string.h>
- #include <iomanip>
- #include <array>
- #include <windows.h>
- #include <cstdlib>
- #include <ctime>
- #include <string>
- using namespace std;
- int main() // main function
- {//function start
- int yeet[5] = {100,22,101,12,7};
- bool done = false;
- int length = 0;
- int stop = sizeof(yeet);
- for (int x = 0; x < 5; x++)
- {
- cout << yeet[x] << ' ';
- }
- system("PAUSE");
- system("cls");
- while(done != true)
- {
- for (int i = 0; i < 4; i++)
- {
- if (yeet[i] > yeet[i + 1])//putting string in order
- {
- swap(yeet[i], yeet[i + 1]);
- }
- for (int x = 0; x < sizeof(yeet) / sizeof(yeet[0]); x++)//checking if string is in order (low to high)
- {
- if (yeet[x] < yeet[x+1])
- {
- length++;
- if (length == stop )
- {
- done = true;
- }
- }
- }
- for (int x = 0; x < 5; x++)
- {
- cout << yeet[x] << ' ';
- }
- Sleep(100);
- system("cls");
- }
- }
- cout << "Sorting is complete, press any key to see finished array.\n";
- system("PAUSE");
- system("cls");
- for (int x = 0; x < 5; x++)
- {
- cout << yeet[x] << ' ';
- }
- cout << endl; //formatting
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment