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
klasskru [66]
2 years ago
12

Create a structure representing a student. The member variables should include student name, student ID, and four test grades fo

r the student (an array of four grades as a member variable). Prompt the user to enter the name, ID, and the four positive test results. Perform error checking for negative values. Store all the data in a structure object. Calculate the average of the three highest grades, dropping the lowest grade. Display the student's name, ID number, four test grades, and the average of the three highest grades. Use a loop to repeat the questions for the next student. You can recycle the same struct object for the next student. Terminate the program when the user decides to stop.
Computers and Technology
1 answer:
Neporo4naja [7]2 years ago
6 0

Answer:

Output:

Name: Brainly

ID:0001

Write the 4 tests grades of the student separated by space :10 9 8 10

Brainly

0001

10 9 8 10

Average :9.66667

'1' to continue '0' to exit :

Explanation:

#include<iostream>

#include<string>

using namespace std;

//variables declaration

struct Student {

  string id; //string declaration ID

  string name; // string declaration name

  int grades[4]; //array of 4 because it is 4 grades

};

//definition of the function get information

void inputData(Student &s){

 

   

   cout << "Name:" ;

   getline(cin,s.name);

   cout << "ID:";

   cin >> s.id;

   cout << "Write the 4 tests grades of the student separated by space :";

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

       cin >> s.grades[i];

}

//definition of the function of average

double inputAvg(Student s){

   double summation;

   int temporary;

   double average;

   for (int i = 0; i<4; i++){  

      for (int j = i; j<4; j++){

         if (s.grades[j] > s.grades[i]){

             temporary = s.grades[i];

             s.grades[i] = s.grades[j];

             s.grades[j] = temporary;

         }

      }

    }

    summation = 0;

    for (int i = 0; i<3; i++){

        summation = summation + s.grades[i];  

    }

    average = summation/3;

    return average;

}

void disp(Student *s){

   cout << s->name << endl;

   cout << s->id << endl;

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

       cout << s->grades[i] << " ";

   cout << endl;

   cout << "Average :" << inputAvg(*s) << endl;

   

}

int main(){

  Student st;

  int ch;

  while(true){

      inputData(st);

      disp(&st);

      cout << " '1' to continue '0' to exit :";

      cin >> ch;

      if (ch == 0)

         break;      

  }

  return 0;

}

You might be interested in
When you begin typing text, the _________________________ appears on the status bar with an animated pencil writing on paper tha
melomori [17]
Spelling and grammar check icons
3 0
3 years ago
Why do we use the internet so much?​
allochka39001 [22]

Answer:

We use the internet because it is a way of finding certain things out that we do not know or a better way of communicating to people who are far away instead of sending a letter to them and it taking 2 to 3 months for it to get to that person.

Explanation:

Your welcome

4 0
2 years ago
100 POINTS NEED THIS BEFORE 11:59 TODAY!!!!!!!!!!!!!!!
AVprozaik [17]

Answer:ok be how hobrhkihfehgdhdj fuiufiisefif jfkijfjfhhfhfhfhf

Explanation:

5 0
3 years ago
Libby wrote an email to her friend. She pressed Shift and the number key 2 together to enter the email address. Which symbol did
exis [7]

When Libby wrote the email to her friend, she typed the '@' symbol. When pressing SHIFT and 2 together, it pastes this aforementioned symbol. However, there isn't any specific name for the symbol. As a matter as fact, there are several names that this symbol goes by.

The most famous name this symbol is called is the "at symbol" or the "at sign". In terms of a formal name, "commercial at" would be a good one.

Here's an example with the symbol:

[email protected]

This is essentially telling the email server where to send your email. From this, they'll know it's located at brainly.com! It's pretty neat.

4 0
3 years ago
Read 2 more answers
Why is computer called information processing machine....?​
mixer [17]

Answer:

Since the computer accepts raw data as input and converts into information by means of data processing

Explanation:

helping!!!

3 0
2 years ago
Read 2 more answers
Other questions:
  • To clean dirt and spilled electrolyte from a battery, use a dilute solution of either water and baking soda or water and A. sulf
    13·1 answer
  • Write a program which simulate rolling dice. When the program runs, it will prompt the user to choose a number ranging from 1 to
    15·1 answer
  • Which of the following that can be use to access session variables in PHP?
    14·1 answer
  • Write a python program that requests a positive integer from the user, determines if it is a composite, a prime or neither prime
    8·1 answer
  • Which of the following does not represent the function of a Variable? Variables store data in memory; this data has limited use
    8·1 answer
  • The costs incurred when a firm buys on the marketplace what it cannot make itself are referred to as
    6·1 answer
  • You are planning a program to find the maximum heart rate recommended for patrons of a gym where you have a part-time job. One f
    13·1 answer
  • I connected to an external hard drive to transfer some photos from my vacation. When I try to drag the photo, it bounces right b
    14·1 answer
  • How can you remove background noise from a video?
    15·2 answers
  • Please answer this simple (hard) question for me lol
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!