Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need helping writing a pseudocode for this program.This program works but i\'m n

ID: 3570554 • Letter: N

Question

Need helping writing a pseudocode for this program.This program works but i'm not sure what the difference between comments and pseudocode is, since they both seem to mean the same thing.

#include // allows program to perform input and output
#include // allows input and output stream class to operate on files
#include // allows program to compute common mathematical operations
using namespace std; // allows program to use all the names in any standard C++ header file
int main() // function main begins program execution
{
   ifstream file; // opening file to read
   char FileName[80];
   int a[100], n = 0; // array a to store data from file to array

   cout << "Please enter the input filename --> "; // reading file name from user
   cin >> FileName;
   file.open(FileName); // open the input file given

   while (!file.eof()) // reading from file data to array a
   {
       file >> a[n];
       n++;
   }

   int min = a[0], max = a[0], range; // store maximum score and minimum score
   double m, s, sum = 0; // sum = total scores, m = mean, s = standard deviation
   for (int i = 0; i    {
       if (a[i]            min = a[i];
       if (a[i]>max)
           max = a[i];
       sum = sum + a[i];
   }
   m = sum / n; // formula for mean
   range = max - min; // calculating range
   sum = 0;
   for (int i = 0; i    {
       sum = sum + ((a[i] - m)*(a[i] - m));
   }
   sum = sum / n;
   s = sqrt(sum); // finding the square root
   double grade[10]; // array to store the values in the formula
   int j = 0, count[11] = { 0 }; // array count to count the number of grades
   for (double i = 4; i >= -5; i--) // calculating the grade, which is given as the formula
   {
       grade[j] = m + (i / 3)*s;

       j++;
   }

   for (int i = 0; i    {
       if (grade[0] <= a[i])
           count[0]++;
       if (grade[1] <= a[i] && a[i]            count[1]++;
       if (grade[2] <= a[i] && a[i]            count[2]++;
       if (grade[3] <= a[i] && a[i]            count[3]++;
       if (grade[4] <= a[i] && a[i]            count[4]++;
       if (grade[5] <= a[i] && a[i]            count[5]++;
       if (grade[6] <= a[i] && a[i]            count[6]++;
       if (grade[7] <= a[i] && a[i]            count[7]++;
       if (grade[8] <= a[i] && a[i]            count[8]++;
       if (grade[9] <= a[i] && a[i]            count[9]++;
       if (grade[10] <= a[i] && a[i]            count[10]++;
       if (a[i]            count[11]++;

   }

   ofstream out; // out is variable of type ofstream
   out.open("outputfile.txt"); // opening file for write
   cout << "Output in the file 'outputfile.txt' " << endl; // telling the user where the outputfile is
   out << " mean: " << m << " standard deviation: " << s; // print the mean and standard deviation in file
   j = 65; //ascii value of j is A
   out << " maximum: " << max << " minimum: " << min << " range of scores: " << range; // print the max, min, and range scores in file
   // printing the grade and number of scores in the file
   out << " Grade " << "Number of Scores ";
   out << " A " << count[0];
   out << " A- " << count[1];
   out << " B+ " << count[2];
   out << " B " << count[3];
   out << " B- " << count[4];
   out << " C+ " << count[5];
   out << " C " << count[6];
   out << " C- " << count[7];
   out << " D+ " << count[8];
   out << " D " << count[9];
   out << " F " << count[10];
   system("pause");
   return 0;
}

Explanation / Answer

Open the file containing the data.

Initialize n=0;

While (file is not empty)

do

store file data-> array a[];

initialize minimum marks, maximum marks and range variables=0;

for(i=0;i<n;i++)

{

calculate minimum, maximum and sum

}

Mean=sum/n;

Range=maximum-minimum

Calculate standard deviation

Initialize grade[10]

//since the grades are dependent on the values of these grade[], which are calculate below

for(i=4;i>=-5;i--)

{

Grade[i]=mean+(i/3)*standard deviation

}

for(i=0;i<n;i++)

compare marks with the value of grade[] and allot the respective grade in array count[]. Increment the value of count[i], every time the score is in the specified boundary of grade[]

open(output.txt)

print the result into the output file;

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote