in C I have to use the void function in this code and call i
(in C++)
I have to use the void function in this code and call it in main to print the grades from int grades[] in descending order. this is what i have so far but i don\'t know what to do in the main function
#include<iostream>
using namespace std;
void sort(double x[], int n);
int main()
{
int grades[] = { 100, 95, 87,92,79 };
return 0;
}
void sort(double x[], int n)
{
int m;
double hold;
for (int k = 0; k <= n - 2; ++k)
{
m = k;
for (int j = k + 1; j <= n - 1; ++j)
if (x[j] > x[m])
m = j;
hold = x[m];
x[m] = x[k];
x[k] = hold;
}
return;
}
Solution
#include![(in C++) I have to use the void function in this code and call it in main to print the grades from int grades[] in descending order. this is what i have so far (in C++) I have to use the void function in this code and call it in main to print the grades from int grades[] in descending order. this is what i have so far](/WebImages/11/in-c-i-have-to-use-the-void-function-in-this-code-and-call-i-1005963-1761518578-0.webp)