Input a class of student grades and stude

nt numbers. Calculate the average grade and standard deviation for the class. Print the student number and student grades in ascending order of the student grade.

Print the grade assigned to each student and the average for the class and the standard deviation. Assume the class has no more than 30 students.

input data

student number scores

321 60.5

542 50.5

524 75.0

235 83.0

565 95.5

123 65.0

257 75.6

258 79.5

259 45.6

260 99.0

261 94.5

Declare an array to hold the student numbers (int student[30]).

Declare another array to hold the corresponding scores

(float scores[30]).

This is my code:

#include <iostream>

#include <fstream>

#include <conio.h>

#include <cmath>

using namespace std;

#define in_file "data.txt"

#define out_file "result.txt"

int main ()

{

ifstream ins; // associates ins as an input stream

ofstream outs; // associates outs as an output stream

int student[30];

int count = 0;

float scores[30];

int counter = 0;

ins.open(in_file);

outs.open(out_file);

while (!ins.eof())

{

ins >> student[counter] >> scores[counter];

counter++;

ins.get(next_char); // to skip the end of line character

}

for (int i = 0; i < counter; i++)

{

cout << student[i] << " " << scores[i] << endl;

}

for (int i = counter -2; i >= 0 ; i = i – 1)

for (int j = 0; j <= i; j++)

if (scores[j] > scores[j + 1])

{

swapFloat (scores[j], scores[j + 1]);

swapInteger(student[j], student[j + 1]);

}

char grades[30];

for (int i = 0; i < counter; i++)

if (scores[i] >= 90.0)

grades[i] = 'A';

else if (scores[i] >= 80.0)

grades[i] = 'B';

else if (scores[i] >= 70.0)

grades[i] = 'C';

else if (scores[i] >= 60.0)

grades[i] = 'D';

else grades[i] = 'F';

ins.close (); // closing input file

outs.close (); // closing output file

}

float findaverage(float scores[], int size)

{

float sum = 0.0;

// summing all the scores

for (int i = 0; i < size; i++)

sum = sum + scores[i];

// return the average which is sum divided by no of students

return sum/size;

}

float findsdev(float scores[], int size, float average)

{

float sumofdifference = 0.0;

for (int i = 0; i < size; i++)

{

sumofdifference += ((scores[i]) – average) * ((scores[i]) – average);

}

return sqrt (sumofdifference / size);

}

appreciate it