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]
3 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]3 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
Which girl is he baddest 1. Shawty 2.Lisa 3.Ashley
Ainat [17]

Answer:

. . . . . . . S H A W T Y.. . .. . .

3 0
3 years ago
Putting the word int into a code will create a string variable?
loris [4]

Answer:

Yes it will create a string variable

4 0
3 years ago
AFLAC, Inc. recently implemented a company policy that all new IT projects must be coordinated and approved by the project manag
Shkiper50 [21]

Answer:

Option (E) is the correct answer to the following question.

Explanation:

Because it helps AFLAC Inc. company to run their project in a more easier way and it also helps its employees to work fast on their new IT projects by installing a WiFi network in their ALFAC inc. branch office. So, that's why they have to install a wireless network.

And the other option is not applied because these activities have to be done in all projects if the project is important either not.

8 0
3 years ago
Can someone tell me 5 facts about Registers and RAM, please?
Maslowich

\int\limits^a_b {x} \, dx \left \{ {{y=2} \atop {x=2}} \right.  \lim_{n \to \infty} a_n \neq \neq \geqAnswer:

A register is a temporary storage area built into a CPU. ... The instruction register fetches instructions from the program counter (PC) and holds each instruction as it is executed by the processor. The memory registers are used to pass data from memory to the processor.

PLS MARK BRAINLIEST!!!

PLEASE

:

3 0
3 years ago
The two most popular forms of animation today are Disney animation and Japanese anime. Each style differs from the other in many
adoni [48]

Answer:

The animation industry has been booming over the past few decades but there have been two animation genres that have stood out from the rest those being the american children's cartoon empire disney and the Japanese industry called anime. One is geared more towards children whilst the other is centered more towards adults. Though these industries may be very different, they both have drawn in a large audience from all around the world. The impacts upon society as a whole are vast and some, unknown.

I wrote a good introductory paragraph hopefully it helps i'm busy now so I can't continue to write your essay hopefully this makes things easier for you

5 0
3 years ago
Other questions:
  • #A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every
    5·1 answer
  • ___ are limited computers because they are placed inside devices which require specific computing functions
    11·1 answer
  • While inspecting an element in the DOM on my website using the Chrome Devtools I accidentally deleted the DIV that had all my au
    8·1 answer
  • Select the correct answer
    14·1 answer
  • Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program where the
    6·1 answer
  • How do i do a mutioutput on a mac
    9·1 answer
  • 1. Pasar los siguientes ejercicios a diagrama de bloque
    11·1 answer
  • Complete the sentence with the correct response.
    12·1 answer
  • Many bookstores have closed since the rise of the Internet. What type of
    11·1 answer
  • Tạo biến
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!