cpplint and msvc fixes for - sorting

This commit is contained in:
Krishna Vedala
2020-05-26 12:15:12 -04:00
parent 76a5f572d5
commit 0d8e015d15
3 changed files with 28 additions and 28 deletions

View File

@@ -42,7 +42,7 @@ optimized bubble sort algorithm. It's right down there.
int main() {
int n;
short swap_check = 1;
bool swap_check = true;
std::cout << "Enter the amount of numbers to sort: ";
std::cin >> n;
std::vector<int> numbers;
@@ -56,11 +56,11 @@ int main() {
}
// Bubble Sorting
for (int i = 0; (i < n) && (swap_check == 1); i++) {
swap_check = 0;
for (int i = 0; (i < n) && (swap_check); i++) {
swap_check = false;
for (int j = 0; j < n - 1 - i; j++) {
if (numbers[j] > numbers[j + 1]) {
swap_check = 1;
swap_check = true;
std::swap(numbers[j],
numbers[j + 1]); // by changing swap location.
// I mean, j. If the number is