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
skad [1K]
3 years ago
9

Write a C++ program that reads students' names followed by their test scores. The program should output each students' name foll

owed by the test scores and 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 stores 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 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. A function to read the students' data into the array.
b. A function to assign the relevant grade to each student.
c. A function to find the highest test score.
d. A function to print the names of the students having the highest test score.
Computers and Technology
1 answer:
Mashutka [201]3 years ago
6 0

Answer:

#include<iostream>

#include<conio.h>

using namespace std;

struct studentdata{

char Fname[50];

char Lname[50];

int marks;

char grade;

};

main()

{

studentdata s[20];

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

   {

cout<<"\nenter the First name of student";

cin>>s[i].Fname;

cout<<"\nenter the Last name of student";

cin>>s[i].Lname;

cout<<"\nenter the marks of student";

cin>>s[i].marks;

}  

 

for (int j=0;j<20;j++)

{

if (s[j].marks>90)

{

 s[j].grade ='A';

}

else if (s[j].marks>75 && s[j].marks<90)

{

   s[j].grade ='B';

}

else if (s[j].marks>60 && s[j].marks<75)

{

 s[j].grade ='C';

}

else

{

 s[j].grade ='F';

}

}

int highest=0;

int z=0;

for (int k=0;k<20; k++)  

{

if (highest<s[k].marks)

{

 highest = s[k].marks;

 z=k;

}

 

}

cout<<"\nStudents having highest marks"<<endl;

 

cout<<"Student Name"<< s[z].Fname<<s[z].Lname<<endl;

cout<<"Marks"<<s[z].marks<<endl;

cout<<"Grade"<<s[z].grade;

getch();  

}

Explanation:

This program is used to enter the information of 20 students that includes, their first name, last name and marks obtained out of 100.

The program will compute the grades of the students that may be A,B, C, and F. If marks are greater than 90, grade is A, If marks are greater than 75 and less than 90, grade is B. For Mark from 60 to 75 the grade is C and below 60 grade is F.

The program will further found the highest marks and than display the First name, last name, marks and grade of student who have highest marks.

You might be interested in
Overheating of a computer can be easily prevented. Explain how​
elixir [45]
Here are a few examples:

•] Keep away from windows or vents to prevent it from turning warm.

•] Clean off dust that’s on the computer.

•] Remove all the things that are blocking air to pass to let it cool down.

•] Putting a soft item below the computer is a action that is prohibited as it blocks the airways which causes it to overheat instead put it on a sturdy flat surface to prevent the aforementioned information.

•] To never overcharge your computer too 100% overnight or any time of the day since it overheats and causes battery life to be short, instead put it to charge when you’re conscious while keeping an eye on it, perhaps set a timer/alarm to notify you if you forget.
5 0
2 years ago
To prevent rust from forming, a light coating of_____should be applied to all machined surfaces
Fantom [35]
What is that I never heard of that before
4 0
3 years ago
During project management, who executes tasks and produces the deliverables as stated in the project plan and as directed by the
san4es73 [151]
B. Project team members
8 0
3 years ago
When a customer makes an online hotel booking the database is updated by using
Valentin [98]
I think it’s a form,if wrong please don’t be mad
4 0
3 years ago
Read 2 more answers
What is the best use of a line chart?
lapo4ka [179]
Line graphs can also be used to compare changes over the same period of time for more than one group. Pie charts are best to use when you are trying to compare parts of a whole. They do not show changes over time. Bar graphs are used to compare things between different groups or to track changes over time.
3 0
3 years ago
Other questions:
  • Give two examples of desktop publishing software
    7·1 answer
  • What microprocessor was the first to be processable<br> ?
    14·1 answer
  • Where do today's computers store almost all motherboard configuration data?
    15·1 answer
  • A software license gives the owner the to use software.
    12·2 answers
  • (BRAINLIEST QUESTION) What are some challenges that will need to be overcome in order for the Internet of Vehicles to become a r
    13·1 answer
  • This is not a feature provided by most GUIS.<br> icons<br> windows<br> forms<br> menus
    14·2 answers
  • The merge sort algorithm sorts using what technique?
    8·1 answer
  • Ask the user to input a number less than 100. Print all the numbers from that number to 100.
    6·2 answers
  • How is knowing how to use word or docs importamt?
    8·1 answer
  • What are some qualities of a good game critic? What are some qualities of a bad game critic?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!