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

Using C++(Visual Studio) Create a struct data type called Student that contains:

ID: 3678713 • Letter: U

Question

Using C++(Visual Studio)

Create a struct data type called Student that contains:

name – a string that may contain blank spaces
id – an integer
percent – a double, current percent of course points
grade – a char representing a letter grade

Main program:
Declare an array of 20 Student records
Ask the user for the name of an input file and open that file for input
Read the Student information from the file into the array (the names, ids, and percents)
Calculate the grade field for each Student in the array (based on a 90/80/70/60/less scale for A/B/C/D/F grades.)
Sort the array of Students into decreasing order, comparing percent values.
Output all of the information for all of the Students (line the fields up in columns to make it easily readable)
Sort the array of Students into increasing order, comparing names.
Output all of the information for all of the Students (line the fields up in columns to make it easily readable)

Use functions to do all of the major tasks in the program (open file, input, calculate, sort, output)

Explanation / Answer

#include<iostream>

#include<string>

#include<stdlib>

#include<array>

#include<fstream>

#include<sstream>

#include<stdio.h>

using name std;

int rowsA=0;

int colA=0;

struct Stu

{

int id;

string name;

double percent;

char Grade;

}

int main()

{

Stu S1[20];

int arrayA[50][50];

string filename;

ifstream fileIN;

cout<<"enter the name of File";

cin>>filename;

fileIN.create(filename);

fileIN.open(filename);

for(int i=1;i<=20;i++)

{

fin>>S1[i];

}

}

readdata()

{

fileIN.open(filename);

if(fileIN.fail())

{

cerr<<"file is not there";

exit(1);

}

cout<<"reading ";

while(fileIn.good())

{

while(getline(fileIn,lineA))

{

istringstream streamA(lineA);

colA=0;

while(streamA>>x)

{

arraA[rowA][colA]=x;

colA++;

}rowA++;

}

}

sort(a,n);

out.open("soted.file")

}

}

}

void sort(int a[],int n)

{

int m=a[n];

int k=n;

while(k=n)

if(a[k-1]>m)

{

a[k]=a[k-1];

k--;

}

else

break;

}

a[k]=m;

}

}

}

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