Question

in c++ A: Write a program which ask user to enter 10 student's name and their...

in c++
A:
Write a program which ask user to enter 10 student's name and their grades.
Then find the average of all the grades.
Output all the grades with student name of whom got the grade over the average.



0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

using namespace std;

int main()
{
string name[10];
int grade[10];
for(int i=0;i<10;i++){
cout<<"Enter the student name: "<<endl;
cin >> name[i];
cout<<"Enter the grade: "<<endl;
cin >> grade[i];
}
int total = 0;
for(int i=0;i<10;i++){
total+=grade[i];
}
double avg = total/10.0;
cout<<"student name of whom got the grade over the average: "<<endl;
for(int i=0;i<10;i++){
if(grade[i]>avg){
cout<<name[i]<<" "<<grade[i]<<endl;
}
}
return 0;
}

Output:

$g++ -o main *.cpp
$main
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
Enter the student name: 
Enter the grade: 
student name of whom got the grade over the average: 
r 56
t 67
j 89
rf 56
tf 67
jf 89
Add a comment
Know the answer?
Add Answer to:
in c++ A: Write a program which ask user to enter 10 student's name and their...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • using C# Write a program which calculates student grades for multiple assignments as well as the...

    using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...

  • Write a program that asks the user for a student name and asks for grades until...

    Write a program that asks the user for a student name and asks for grades until the user enters a non-number input, it should then ask if the user wants to enter another student, and keep doing the process until the user stops adding students. The student’s must be stored in a dictionary with their names as the keys and grades in a list. The program should then iterate over the dictionary elements producing the min, max, and mean of...

  • You are to write a program which will ask the user for number of students (dynamic...

    You are to write a program which will ask the user for number of students (dynamic array of class Student). For each student, you will ask for first name and number of grades (dynamic array of grades as a variable in Student). **The program should give the student random grades from 0-100** Find the averages of each student and display the information. **Display name, grades, and average neatly in a function in the Student class called Display()** Sort the students...

  • You are to write a program which will ask the user for number of students (dynamic...

    You are to write a program which will ask the user for number of students (dynamic array of class Student). For each student, you will ask for first name and number of grades (dynamic array of grades as a variable in Student). **The program should give the student random grades from 0-100** Find the averages of each student and display the information. **Display name, grades, and average neatly in a function in the Student class called Display()** Sort the students...

  • Homework 1 - Simple Array Handling Write a working C++ program to ask the user for...

    Homework 1 - Simple Array Handling Write a working C++ program to ask the user for a set of grades which are to be stored in an array in increasing sequence. The user must first provide the number which represents the count of all grades to be provided. For example, if there will be 10 grades, the user is first prompted to provide the number 10. Subsequently, each grade is provided, one at a time. Allow for a maximum of...

  • This code should be written in php. Write a program that allows the user to input...

    This code should be written in php. Write a program that allows the user to input a student's last name, along with that student's grades in English, History, Math, Science, and Geography. When the user submits this information, store it in an associative array, like this: Smith=61 67 75 80 72 where the key is the student's last name, and the grades are combined into a single space-delimited string. Return the user back to the data entry screen, to allow...

  • First, create two inputs that can be stored in variables consisting of a student's name. When...

    First, create two inputs that can be stored in variables consisting of a student's name. When the program begins ask "Who is the first student?" followed by "Who is the second student?" You only have to have two students for this program. Ask the user for the scores for the last three test grades for each of the students .   After the user has entered both names, and three scores for each, the program should display the following as output:...

  • Write a c++ program that does the following: in main() 1. prompts for a student's name...

    Write a c++ program that does the following: in main() 1. prompts for a student's name (with spaces_ 2. prompts for 3 grades 3. Calls a function to calculate the average of the 3 grades - arguments must be passed by value 3. displays the student's name and average grade - example: Fred Smith : 85.5 - the average should be a float displaying 1 digit of precision

  • Language: C++ Write a program that will allow the instructor to enter the student's names, student...

    Language: C++ Write a program that will allow the instructor to enter the student's names, student ID, and their scores on the various exams and projects. A class has a number of students during a semester. Those students take 4 quizzes, one midterm, and one final project. All quizzes weights add up to 40% of the overall grade. The midterm exam is 25% while the final project 35%. The program will issue a report. The report will show individual grades...

  • Q3. Write a MATLAB program that prompt the user to enter number of studentsN) Then, gave each stu...

    Q3. Write a MATLAB program that prompt the user to enter number of studentsN) Then, gave each students their grades(G1, G2,.GN), find the average grade (AV), the biggest grade (M) and the rank of the biggest grade(R). INPUT: 5,50,60,70,80,90), OUTPUT(70,90,5) Q3. Write a MATLAB program that prompt the user to enter number of studentsN) Then, gave each students their grades(G1, G2,.GN), find the average grade (AV), the biggest grade (M) and the rank of the biggest grade(R). INPUT: 5,50,60,70,80,90), OUTPUT(70,90,5)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT