C I need helpSolutioninclude using namespace std void GenSco
C++ I need help!
Solution
#include<bits/stdc++.h>
 using namespace std;
 void GenScore(int a[]) //Random number function
 {srand(time(0));
    for(int i=0;i<30;i++)
    {
       
            int rnd = rand() % (100-1) + 1;
           a[i]=rnd;
    }
}
 int SortArray(int array[])//Bubble sort function
 {
    int c,d;
    for (c = 0 ; c < ( 30 - 1 ); c++)
 {
 for (d = 0 ; d < 30 - c - 1; d++)
 {
 if (array[d] > array[d+1]) /* For decreasing order use < */
 {int swap;
 swap = array[d];
 array[d] = array[d+1];
 array[d+1] = swap;
 }
 }
 }
 }
void Display(int a[])//Display array function
 {
    for(int i=0;i<30;i++)
    {
           
           cout<<a[i]<<endl;;
    }
 }
 void CalSD(int data[])//Function to find SD
 {
    float sum = 0.0, mean, standardDeviation = 0.0;
    int max=INT_MIN;
    int min=INT_MAX;
 int i;
for(i = 0; i < 30; ++i)//find sum of data
 {
 sum += data[i];
 }
for(i = 0; i < 30; ++i)//find min and max from data
 {
 if(data[i]>max)
    max=data[i];
 if(data[i]<min)
    min=data[i];
 }
cout<<\"Max Score is \"<<max<<endl;
 cout<<\"Min Score is \"<<min<<endl;
mean = sum/30;//Find average
cout<<\"Average is \"<<mean<<endl;
for(i = 0; i < 30; ++i)//Find SD
 standardDeviation += pow(data[i] - mean, 2);
cout<<\"SD is \"<<sqrt(standardDeviation / 30)<<endl;
 }
 int main(int argc, char const *argv[])
 {
    int a[30];
    GenScore(a);
    CalSD(a);
    cout<<\"Sorted Array is\"<<endl;
    SortArray(a);
    Display(a);
  
   
    return 0;
 }
===============================================
akshay@akshay-Inspiron-3537:~/Chegg$ g++ sd.cpp
 akshay@akshay-Inspiron-3537:~/Chegg$ ./a.out
 Max Score is 92
 Min Score is 2
 Average is 41.6333
 SD is 28.7408
 2
 2
 4
 8
 9
 11
 12
 20
 21
 22
 22
 25
 30
 32
 39
 39
 41
 41
 44
 44
 57
 73
 77
 78
 79
 80
 80
 81
 84
 92
 akshay@akshay-Inspiron-3537:~/Chegg$
====================================
Comment about work
![C++ I need help!Solution#include<bits/stdc++.h> using namespace std; void GenScore(int a[]) //Random number function {srand(time(0)); for(int i=0;i<30; C++ I need help!Solution#include<bits/stdc++.h> using namespace std; void GenScore(int a[]) //Random number function {srand(time(0)); for(int i=0;i<30;](/WebImages/11/c-i-need-helpsolutioninclude-using-namespace-std-void-gensco-1007086-1761519294-0.webp)
![C++ I need help!Solution#include<bits/stdc++.h> using namespace std; void GenScore(int a[]) //Random number function {srand(time(0)); for(int i=0;i<30; C++ I need help!Solution#include<bits/stdc++.h> using namespace std; void GenScore(int a[]) //Random number function {srand(time(0)); for(int i=0;i<30;](/WebImages/11/c-i-need-helpsolutioninclude-using-namespace-std-void-gensco-1007086-1761519294-1.webp)
![C++ I need help!Solution#include<bits/stdc++.h> using namespace std; void GenScore(int a[]) //Random number function {srand(time(0)); for(int i=0;i<30; C++ I need help!Solution#include<bits/stdc++.h> using namespace std; void GenScore(int a[]) //Random number function {srand(time(0)); for(int i=0;i<30;](/WebImages/11/c-i-need-helpsolutioninclude-using-namespace-std-void-gensco-1007086-1761519294-2.webp)
