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
I couldn't log in cuz I was banned but here I am with the same username again lol hi
rodikova [14]

Answer:

hi how are you......

Explanation:

6 0
3 years ago
What's it called when a program is expandable?
sashaice [31]
Its called a genesis program
6 0
3 years ago
What is the first step to apply the line and page breaks options to groups of paragraphs in a Word document?
bezimeni [28]

Answer:

accessing the Paragraph dialog box

Explanation:

8 0
3 years ago
Read 2 more answers
How do you change the render setting on Blender to render shadows and light?
garik1379 [7]

To see shadows in 3D (textured) mode, you must have switched to GLSL mode before making any materials. In MultiTexture mode, shadows only appear in the rendered image.


Hope this helps!

5 0
3 years ago
In regards to network security, ________ means preventing unauthorized users from gaining information about the network structur
ratelena [41]

Answer: C. Confidentiality

Explanation: Confidentiality with regards to security simply means securing information belonging to certain individuals, group, entity or issues and information of national security or high level clearance by avoiding leakage to authorized persons or groups.

With regards to network structure, confidentiality encompasses safe keeping of network data structure, packet header, network protocols and other information relevant to network structure by preventing illegal or unauthorized access to such information through the use of firewalls and top level security systems.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids.Sample output for the g
    11·1 answer
  • Business Risks are ​
    15·1 answer
  • Write a calculator program using a switch statement that: a) Prompts the user to enter two numbers b) Prompts the user to select
    13·1 answer
  • Design and implement a class called Sphere that contains instance data that represent the sphere’s diameter. Define the Sphere c
    6·1 answer
  • Nikolas has a idea that he could use the compressed carbon dioxide in a fire extinguisher to propel him on his skateboard. Nikol
    13·2 answers
  • What features are offered by most of the email programs with for receiving and sending messages?
    10·1 answer
  • Which line of code outputs the decimal portion of a float stored in the variable x? print (x % 1000) print (x) O print (x / 1000
    13·1 answer
  • I love my baby boy and can someone help me with this
    6·1 answer
  • According to the video, what are some concerns of Webmasters? Check all that apply.
    7·2 answers
  • Consider the following declaration: (1, 2) double currentBalance[91]; In this declaration, identify the following: a. The array
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!