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
The themes gallery is located on the _____ ribbon tab
Mrac [35]
The themes gallery is located on the "design" ribbon tab
6 0
3 years ago
Read 2 more answers
If Mike saves $160 each month, how much will he save in 12 months? Enter your answer in the box.
denis-greek [22]

Answer:

$1,920

Explanation:

i think its that bc 160 x 12=1,920

im sorry if wrong but if right can i get brainlest?

7 0
2 years ago
Does anybody know the hack on how to be the among us Impostor every time? Please help!!!!
sweet [91]

Answer:

nope.....

Explanation:

bdjsbsijsebdjxh

6 0
2 years ago
OO<br>(A) 3 and 5<br>(B) 4 and 8<br>(C) 2 and 0<br>(D) 6 and 9<br>2. There are twelve books on a shelf and four children in a ro
dlinn [17]

Explanation:

2.there will be 8 books left on the shelf if each child takes one

8 0
2 years ago
Why is a niche important in video production
abruzzese [7]

Answers

You need a niche to start your recording for let's say commentary you'll need that for your commentary.

7 0
2 years ago
Read 2 more answers
Other questions:
  • Load the solver add-in if it is not already loaded. click the budget worksheet and set the objective to calculate the highest ba
    15·1 answer
  • What allows people to create their own radio shows over the internet?
    14·1 answer
  • Write a program that lets a maker of chips and salsa keep track of their sales for five different types of salsa they produce: mi
    8·1 answer
  • _________ are represented using diamonds linked withparticipant ETs
    6·1 answer
  • Which printout will result from the snippet of code?
    9·1 answer
  • )In a graph represented by adjacency matrix u can find all the neighbours of a given vertices in ____Operations
    6·1 answer
  • It is necessary tto save updates often when working in google docs? True or false
    11·2 answers
  • Anyone has any ideas for a gaming setup i can buy for christmas. Something with high framing rates (monitor included) for about
    15·1 answer
  • Activity 1.1.4 What is Technology?
    10·1 answer
  • Using the functions from problems 1 and 2, write a MATLAB script to compare the laminar results from to the turbulent results. C
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!