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 security option in MySQL, that when enabled, limits where a file can be loaded from when using the LOAD DATA INFILE command
swat32

Answer:b) secure_file_priv

Explanation: MYSQL database is the SQL data collection where the command LOAD DATA INFILE is used for the transporting the data-file from the local server to the MYSQL server. This command helps the reading the file's data or text of the client server at rapid speed

The secure_file_priv is the option that is raised from the LOAD DATA INFILE for the limited loading of files from the directories and also makes it secure. Other options are incorrect because they are used for the location and loading.Thus the correct option is option(b).

6 0
3 years ago
You would like to set up on online meeting to communicate with colleagues on a group project. Which of these tools should you su
Elenna [48]
WebEx :))))))))))))))))))))))
8 0
3 years ago
Read 2 more answers
What is the first thing Kernel does when WinLoad turns over the starttup process to it
SashulF [63]

It activates HAL, reads more information from the registry, and builds into memory the registry key

4 0
3 years ago
In this lab, you complete a partially prewritten Python program that uses a list.
PSYCHO15rus [73]

Answer:

See Explanation

Explanation:

Required

Complete the given code

First, it should be noted that the original code (in the question) is complete, however it is poorly formatted.

The errors that may arise when the code is run is as a result of the poor format of the code.

I've corrected all errors and I fixed the indentations in the original code.

<em>See attachment for the complete code.</em>

Download txt
4 0
3 years ago
What special member function of a class is called whenever an instance of a class is created and initialized?
allochka39001 [22]
It's called a constructor function, but it's name is the same as the class' name.
6 0
3 years ago
Other questions:
  • Assume the following rules of associativity and precedence for expressions:
    7·1 answer
  • Write a short Python function, is_multiple(n, m), that takes two integer values and returns True is n is a multiple of m, that i
    9·1 answer
  • If you wish to edit a data source in a document, you can make modifications when you select the data sources or _____.
    7·2 answers
  • Write a program that calculates taxi fare at a rate of $1.50 per mile. Your pro-gram should interact with the user in this manne
    12·1 answer
  • Want summmmmmmm bec i do lol
    9·1 answer
  • Which step is done first to replace existing text in a text box?
    10·2 answers
  • Explain Spreadsheet and its Basics
    13·1 answer
  • Why is it saying I don’t have a subscription when I paid for it and it shows deducted from my account? I can’t find any phone #
    7·1 answer
  • Complete the code to convert a float to a string. <br> answer=5.3 <br> strAnswer=__ (answer)
    12·2 answers
  • 1. A cell is identified by its ........
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!