1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
iren [92.7K]
3 years ago
13

Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed

by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Your program must contain at least the following functions: A function to read the students’ data into the array. A function to assign the relevant grade to each student. A function to find the highest test score. A function to print the names of the students having the highest test score. Your program must output each student’s name in this form: last name followed by a comma, followed by a space, followed by the first name; the name must be left justified. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls.
Computers and Technology
1 answer:
bekas [8.4K]3 years ago
5 0

Answer:

See explaination

Explanation:

#include <iostream>

#include <iomanip>

#include <fstream>

#include <string>

using namespace std;

void readStudentsData();

void levels(int&,int&,int&);

int main()

{

string studentsName[50];

int grade[50];

int highestScore = 0;

int belowAverage = 50;

int countStudents = 0;

int sum = 0;

int score[5]=

double average = 0;

ifstream infile;

ofstream outfile;

void readStudentsData();

infile.open("c:\\Data.txt");

int numOfStudents = 0;

infile >> studentsName[numOfStudents] >> grade[numOfStudents];

While (infile && numOfstudents < 50)

{

numOfStudents++;

infile >> studentsName[numOfStudents] >> grade[numOfStudents};

}

if (!infile)

{

cout << "File does not open." << endl;

return 1;

}

outfile.open("c:\\average.out");

outfile << fixed << showpoint;

outfile << setprecision(2);

infile >> studentsName;

infile >> score1 >> score2 >> score3 >> score4 >> score5 >>;

outfile << left << setw(20) << "Students Name"

<< setw(5) << "Score 1" << setw(5) << "Score 2"

<< setw(5) << "Score 3" << setw(5) << "Score 4"

<< setw(5) << "Score 5" << setw(5) << "Grade"

<< setw(5) << "Average" << setw(5) << "Below average"

<< setw(5) << "Highest" << endl;

if (average >= 90)

cout << "A" << endl;

else if (average >= 80)

cout << "B" << endl;

else if (average >= 70)

cout << "C" << endl;

else if (average >= 60)

cout << "D" << endl;

else

cout << "F" << endl;

}

average = static_cast<double>(score1+score2+score3+score4+score5) /5;

void level(int &highestScore,int &belowAverage,int &sum);

{

int level,high = 0,low = 17;

infile >> level;

while(level!=-1)

{

sum = sum + level;

if (level > high)

{

high = level;

infile >> level;

}

else

if (level < low)

{

low = level;

infile >> level;

}

else

if infile >> level;

}

outfile << ' ' << high;

else

if (high > highestScore)

highestScore=high;

else

if (low < belowAverage)

belowAverage=low;

}

do

{

cout << "Students Name: ";

cin >> name

cout << "Input score: " << endl;

cin >> score1>> score2>> score3>> score4>> score5;

cout << Students Name << Highest score);

}

While (highest score !=0);

infile.close();

outfile.close();

return 0;

}

You might be interested in
Which of the following has the greatest impact on telecommunications design?
Harrizon [31]

Answer:

A

Explanation:

Hope Brainly understood

6 0
3 years ago
Read 2 more answers
Advantage and disavantage of malware maintenance
damaskus [11]
Well, advantages are,

it keeps your computer secure
less likely to get a virus or malware
can keep your passwords and bank details safe if entered online (if you use software like avast)

disadvantages are

they can be expensive to buy
can use a lot of room on your pc
sometimes cant fully remove a virus and just puts it into a virus locker or chest
they can sometimes be almost impossible to remove and act like a virus themselves (norton, avg etc)
8 0
3 years ago
E Highlight
Arlecino [84]

Answer: See explanation

Explanation:

The uses of information

communication technology in the health sector​ include:

• Improvement in the safety of patients through direct access to case story.

• Keeping track of the progress of the patient.

• Checking of the treatments for a disease it illness online.

• It's also vital for the electronic storage of the medical data.

7 0
3 years ago
Can a computer will work more efficiently if you perform disk optimization
Brilliant_brown [7]
It’s true because the optimization is the software that cleans up the fragments in a hard drive.
7 0
3 years ago
If you anticipate running a particular query often, you can improve overall performance by saving the query in a special file ca
mestny [16]

If you anticipate running a particular query often, you can improve overall performance by saving the query in a special file called a(n)  stored procedure.

<h3>What is meant by stored procedure?</h3>

An application that uses a relational database management system can access a subroutine known as a stored procedure. These processes are kept in the data dictionary of the database. Access control and data validation are two applications for stored processes.

A stored procedure is a collection of SQL statements that have been given a name and are kept together in a relational database management system (RDBMS) so they may be used and shared by various programs.

If you expect to run a certain query frequently, putting it in a special file known as a(n) stored procedure can enhance overall speed.

To learn more about stored procedure refer to:

brainly.com/question/13692678

#SPJ4

3 0
1 year ago
Other questions:
  • What type of attack intercepts communication between parties to steal or manipulate the data?
    13·1 answer
  • Search the internet for news of a motor vehicle collision in your community involving drugs or alcohol. Keeping in mind that you
    8·1 answer
  • Based on the passage​ and/or drawing on your prior​ knowledge, you realize that an HMO is​ what?
    9·1 answer
  • Based upon what you know
    5·1 answer
  • Find the range of the function for the domain<br>(-4,-2,0, 1.5,4).<br>f(x) = 5x²+ 4<br>​
    13·1 answer
  • Assume that we have an application with a total of 500,000 instructions where 20% of them are the load/store instructions with a
    14·1 answer
  • Anyone here play osu! ?
    11·2 answers
  • What is cyber security ???​
    8·1 answer
  • How can a classroom be more effective by the use of multimedia? ​
    12·1 answer
  • a(n) is an object that defines a screen element used to display information or allow the user to interact with a program in a ce
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!