We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
#include using namespace std;
void bubble_sort(int a[], int size);
int main(void) { int arr[10] = {10, 2, 4, 1, 6, 5, 8, 7, 3, 9}; int i = 0;
cout << "To sorting: \n"; for (i=0; i<10; i++) cout << arr[i] <<" "; cout << endl; bubble_sort(arr, 10); cout << "Later on: \n"; for (i=0; i<10; i++) cout << arr[i] << " "; cout << endl; return 0;
}
void bubble_sort(int a[], int size) { int switched = 1; int hold = 0; int i = 0; int j = 0;
size -= 1; for (i = 0; i < size && switched; i++) { switched = 0; for(j = 0; j < size - i; j++) if(a[j] > a[j+1]) { switched = 1; hold = a[j]; a[j] = a[j + 1]; a[j + 1] = hold; } }
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: