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
Ses
jekas [21]

Answer:

Amoung us

Explanation:

When the imposter is sus

8 0
3 years ago
Plz can someone tell me the answers ?
Ganezh [65]

Answer:

you can

Explanation:

you can

5 0
2 years ago
Read 2 more answers
What types of information should have their sources cited to avoid plagiarism? List at least 3
Sindrei [870]

Answer:

Everything.It doesn't matter the information because there's always a way to plagiarize.No matter what the information, always, ALWAYS, cite the source.

Explanation:

6 0
2 years ago
Concept tests in the screening and evaluation stage of the new-product process rely on written descriptions, sketches, or mock-u
pochemuha

Answer:

The answer is "Actual products".

Explanation:

The key purpose of this research is to better analyze the concepts, which is done to establish customer buying expectations and perceptions of the item. The key point is to assess the consumers ' initial response to the product idea.

  • This concept testing is also known as a creation, it is an advantage, which can be conveyed to the user to test their reactions.  
  • In conceptual testing, it is a quality check between the design definition and the actual production of the product.

6 0
3 years ago
Five programs are currently being run in a computer. Program 1 is using 10 GiB of RAM, program 2 is using 5 GiB of RAM, program
muminat

Virtual memory could be used to allow program 5 to access RAM without any of the data from the other four programs being lost because it is one that tend to allows the system to give all of the process its own memory space that is said to be  isolated from the other processes.

<h3>How is virtual memory used instead of RAM?</h3>

A system is known to make use of a virtual memory and this is one that tend to make use of a section of the hard drive to act like the RAM.

With the use of virtual memory, a system can be able to load bigger or a lot of programs running at the same time, and this is one that tends to hep one to work as if it has more space, without having to buy more RAM.

Therefore, Virtual memory could be used to allow program 5 to access RAM without any of the data from the other four programs being lost because it is one that tend to allows the system to give all of the process its own memory space that is said to be  isolated from the other processes.

Learn more about virtual memory from

brainly.com/question/13088640

#SPJ1

6 0
1 year ago
Other questions:
  • .2. What approach to deviance do you find most persuasive: that
    9·1 answer
  • In Microsoft Word, when you highlight existing text you want to replace, you are in what
    11·1 answer
  • What do you think about the use the top song on a video you are creating
    8·2 answers
  • If you were given a 3D microscope to use for photography, which object(s) would you most want to photograph?
    10·2 answers
  • When a range of IP addresses is set aside for client devices, and one of these IPs is issued to these devices when they request
    14·1 answer
  • CRM systems provide an organization with an important element: all employees of the company who directly or indirectly serve a c
    9·1 answer
  • In what stage of an algae or fungi life cycle are they able to reproduce spores?
    10·1 answer
  • You have many drugs that you want to store electronically along with their purchase dates and prices, what kind of software woul
    7·1 answer
  • The email_list function receives a dictionary, which contains domain names as keys, and a list of users as values. Fill in the b
    14·1 answer
  • Why is technology bad for you
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!