Transform this exercise of sorting into functions:
#include#include#includeusing namespace std;int main(){ srand(time(0)); const int size=5; int grades[size]={0}; int temp=0; for(int i=0; i<> grades[i]= rand()%101; for(int i=0; i cout<><">"> cout<> //sorting at most you need n-1 iterations to sort the array. for(int iteration=1; iteration<=size-1;iteration++) external="">=size-1;iteration++)> for(int i=0; i { if(grades[i]>grades[i+1]) { temp = grades[i]; grades[i] = grades[i+1]; grades[i+1] = temp; } } for(int i=0; i cout<><">"> cout<> return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here