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
Montano1993 [528]
3 years ago
14

Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays th

e student with the highest score (display the student's name and score). Also calculate the average score and indicate by how much the highest score differs from the average. Use a while loop.

Computers and Technology
1 answer:
zhenek [66]3 years ago
5 0

Answer:

Follows are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main()//defining main method

{

int n,s=0,j,number,h=-1;//defining integer variables

string name, nh;//defining string variable

float avg;//defining float variable

cout<<"Enter the number of students: ";//print message

cin>>n;//input value in n

while (j< n) //defining loop for input value

{

getline(cin, name);//use getline method to input value

cout<<"Enter the student name: ";//print message

getline(cin, name);//use getline method to input value

cout<<"Enter the score: ";//print message

cin>>number;//input number value

s+= number;//add numbers into s variable

if(h<number)//defining if block that checks h is greater then number

{

nh= name;//use string variable nh to store name value

h= number;//use integer variable h to store name value

}

j++;//increment j value by 1

}

cout<<name<<endl;//print highest name value

cout<<"score: "<<h<<endl;//print highest score value

avg = (float)s/(float)n;//calculate the average value

cout<<"Average is: "<<avg<<endl;//print average value

cout<<"Difference: "<<(h-avg)<<endl;//print average difference

return 0;

}

Output:

please find attached file.

Explanation:

In the above code, inside the main method four integer variable "n,s,j, number, and h", two string variable "name and nh" and one float variable "avg" is defined.

In the next step, n is defined that is used for the input value. and Inside the main method, a while loop is defined, which uses the "getline" method to the input value, and use s variable to add all numbers.

In the next step, if a block is defined that checks "h" is greater than the number value if the condition is true, it will print the highest value of the input variable and its average difference.

You might be interested in
Who was the first person to make a portable computer?
Bad White [126]
It was invented by Osborne<span> Computers</span>
8 0
3 years ago
If the pc­doctor software is installed on a computer's hard drive, what two different ways can the program be started?
xeze [42]
<span> The PC-doctor software is system information tool used to diagnose and  test the computer and determine its configuration.</span>
If the PC-­doctor software is installed on a computer's hard drive, you should start the program in two different ways:<span>
1. Press function key during startup sequence
2. Start menu shortcut</span>


8 0
4 years ago
10 to the 8th power divided by 10 to the -4th power
sammy [17]
The answer is 10 to the twelfth power.

8 0
4 years ago
Which of the following is a right of a user of information systems?
Eva8 [605]

Answer:

Option A is the correct option for the following question.

Explanation:

The following option is correct because this option is one of among four rights of the user of an information system which is collectively important for those users who working in any organization, company or firm. It always requires the new and the upcoming features or the function of the system.

Option B is wrong because it is not the right of the user and the right is don't disclose the secrets of your firm or company to any outsiders or any person who are not reliable.

Option C is wrong because it is not the right of the user.

Option D is wrong because it is not the right of the user and it is the responsibility of all computer users to keep their systems fit and fine.

4 0
4 years ago
why is it important to include keywords that represent each of the essential concepts that make up your research question when y
SpyIntel [72]

Answer:

hi

Explanation: hi

7 0
3 years ago
Other questions:
  • What percentage of the global population of about seven billion people used the Internet in 2012?
    5·2 answers
  • 1.using synonyms can help make ur writing more________
    11·1 answer
  • In a proper webpage, which tag holds all of a webpages visible HTML?
    5·1 answer
  • Angela recently purchased a new Android smartphone. While purchasing the phone, Angela was told that she would need to set up a
    5·1 answer
  • Fill in the code to complete the following function for computing a Fibonacci number. public static int fib(int index) { if (ind
    6·1 answer
  • Which approach to knowledge management capitalizes on tacit knowledge and requires heavy IT investment?
    8·1 answer
  • If cost of 1 kg sugar is 36 find price of 3 kg sugar​
    8·1 answer
  • How computer viruses spread from one computer to another​
    10·1 answer
  • Which line of code will use the overloaded division operation?
    6·1 answer
  • Using computers can lead to a number of physical safety issues. State and explain TWO(2) of these types of issues.​​​​​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!