Question

Write a complete program that prompts the user to enter the number of students and each...

Write a complete program that prompts the user to enter the number of students and each student’s score,

then finally displays the highest score.(in C++)

Homework Answers

Answer #1

The answer to this question is as follows:

The code is as follows:

#include <iostream>

using namespace std;

int main() {
int num_students;
  
cout<<"Enter the number of students:";
cin>>num_students;
int students[num_students];
cout<<"Enter the students score:\n";
for(int i=0;i<num_students;i++)
{
cin>>students[i];
}
int max=students[0];
for(int i=0;i<num_students;i++)
{
if(max<students[i])
{
max=students[i];
}
}
cout<<"The maximum score is:"<<max;
}

The input and output are provided in the screenshot below:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program that prompts the user to enter a string and displays the number of...
Write a program that prompts the user to enter a string and displays the number of characters it contains, fourth character, and last character. Note: The string may contain blanks. For example: “C++ programming is fun”. You should write a complete program.
Write a program that prompts the user to enter an integer number between 1 and 999....
Write a program that prompts the user to enter an integer number between 1 and 999. The program displays the sum of all digits in the integer if the input is valid; otherwise, it displays a message indicating that the integer is not between 1 and 999 and hence, is invalid. Name the program file Q1.cpp Example: if the user enters 12, sum of digits is 3. If the user enters 122, sum of digits is 5.
Write a complete C program that prompts the user for the coordinates of two 3- D...
Write a complete C program that prompts the user for the coordinates of two 3- D points ( x1 , y1 , z1 ) and ( x2 , y2 , z2 ) and displays the distance between them computed using the following formula: distance= square root of (x1-x2)2+(y1-y2)2+(z1-z2)2
PLEASE USE LOOPS ONLY TO COMPLETE THIS ASSIGNMENT. (Find the three lowest scores) Write a program...
PLEASE USE LOOPS ONLY TO COMPLETE THIS ASSIGNMENT. (Find the three lowest scores) Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the lowest score and the student with the second-lowest score and the student with the third lowest score. Program must accept first name only or first and last name SAMPLE RUN #1: java ThreeLowestScores   Enter the number of students:6↵ Student 1 of...
Write a program that prompts the user to enter time in 12-hour notation. The program then...
Write a program that prompts the user to enter time in 12-hour notation. The program then outputs the time in 24-hour notation. Your program must contain three exception classes: invalidHr, invalidMin, and invalidSec. If the user enters an invalid value for hours, then the program should throw and catch an invalidHr object. Follow similar conventions for the invalid values of minutes and seconds. This needs to be done in C++ There needs to be a separate header file for each...
Write a C program that prompts the user to enter a line of text on the...
Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr and readLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate on NUL-terminated...
Write a C program, called logic_abc.c, that prompts the user to enter three integers a, b,...
Write a C program, called logic_abc.c, that prompts the user to enter three integers a, b, c, and then computes the results of the following logical operations, in sequence: !a || !b++ && c (a-1 || b/2) && (c*=2) (a-- || --b) && (c+=2) a || !(b && --c)
Write a program that prompts the user for the number of values for which it will...
Write a program that prompts the user for the number of values for which it will calculate the base 2 log of each value. Use a for loop to iterate the set of values and print the log for each. Here is the formula to change the base of a log: loga b = log10 b / log10 a Sample output appears below. This program will calculate the Base 2 log of a set of numbers<LINERETURN> ===============================================================<LINERETURN> Enter the upper...
Write a program that prompts the user for a number from 1 to 200 until 113...
Write a program that prompts the user for a number from 1 to 200 until 113 is encountered. Not including the 113, calculate the average. Do this in python. DO NOT USE LISTS!
Q :     Write a C++ program that asks the user to enter three integers and...
Q :     Write a C++ program that asks the user to enter three integers and then displays the largest one. Example : if the user enter ( 7, 2 ,5) the largest number will be 7 Or if user enter ( 2 , 5 , 7 ) the largest number will be 7 Or if user enter ( 7, 5 ,2) the largest number will be 7 In general it does not matter the order of the entered numbers...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT