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
The process of making raw materials into a finished product is known as
Olin [163]
1.) Business Engineering or Manufacturing :)
<span />
6 0
2 years ago
Read 2 more answers
I am trying to make a flowgorithm chart for a dogs name, age, weight and when their weight is less than 50 OR more than 100 its
kumpel [21]

Answer:

i think it helps

Explanation:

sorry there was someone else rude as heck messaging and responding I couldn't see their screen name

what isig naame

oh okay

I have sent dm

i dont know your name there

5 0
2 years ago
When records are in ____ order, they are arranged one after another on the basis of the value in a particular field.?
Nat2105 [25]
When records are in ASCENDING order ...
4 0
3 years ago
On the seventh day of the iteration, the team realizes that they will not complete 5 of the 13 stories. the product owner says s
nika2105 [10]

Answer:

First of all the team should excuse to the product owner for not being responsible and committed to the deadline.

Secondly, as they have completed the 8 stories, so they should revise and check the flaws in those stories and send to her.

Because when the product owner will check and happy with them, she will surely discuss the remaining stories with the team.

6 0
3 years ago
100 POINTS
agasfer [191]

Answer:

i'm just a kid ku ku ku ku ku ku ku ku ku ku ku ku

6 0
2 years ago
Other questions:
  • Jannette has been experiencing slow performance on her computer. Today she received an error message saying that an update to he
    12·2 answers
  • You are looking to buy a laptop on a budget and want to save money by not purchasing an extended service agreement with the manu
    13·1 answer
  • A style manual can be described as
    11·2 answers
  • Sierra owns a small business and handles many responsibilities, from logistics to marketing. She's seen a lot of success with Go
    11·1 answer
  • Explain the difference between the legal protections a security officer enjoys and the legal protections a police officer receiv
    12·2 answers
  • Write a line of code to convert time to hours. Remember there are 60 minutes in an hour. Then write a line of code to calculate
    9·2 answers
  • What is multimedia computer system​
    7·1 answer
  • Which is a concept of the CIA of Computer Security
    7·1 answer
  • True or False <br> Hebrew Bible and the Koran were first written in English.
    15·1 answer
  • Make variables to represent the length and width of a rectangle, called length and width, respectively. You should set length to
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!