Transform this exercise of sorting into functions: #include #include #include using namespace std; int main() { srand(time(0)); const int size=5; int grades[size]={0}; int temp=0; for(int i=0; i


Transform this exercise of sorting into functions:


#include
#include
#include
using 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="">
    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;
}



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here