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
What types of items can tab be used to complete once you start typing the entities' name?
White raven [17]
The answer to this question is <span>file, command, or directory names
File is the part of the program that could be used to store various information. The command is part of the program that give abilities for user to run a certain program within the system operation. Directory names will create some sort and arrangement on collection of files</span>
3 0
3 years ago
What does syntax error mean :-;<br>explain briefly.<br><br>thankyou!
Alex Ar [27]
A syntax error is an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language. For compiled languages, syntax errors are detected at compile-time. A program will not compile until all syntax errors are corrected.
3 0
1 year ago
Need help with these
AnnyKZ [126]

Answer:

1. D

2. B

3. D

Explanation:

vnasgbaenVmad7kDg Zg

8 0
3 years ago
Which of the following is not a barrier to corporate control?​ a. ​antitakeover amendments b. ​proxy contests c. ​poison pills d
Elan Coil [88]

Answer: Proxy contest.

Explanation:

In corporate control it is the authority of the corporate organisation to take all the major decision. It takes decisions on matters related to marketing, investment, new project sanctioning, new fund raising, policy of the corporate and etc.

Among all the options we have proxy contest enable to secure enough votes in the corporate to win over the governance in the corporate. It is more over like an unfriendly war between the corporate allies. It garners support from stakeholders to gain corporate vote.

However, all the other options such as golden parachutes whereby an employee can get certain benefits if its employments is terminated and antitakeover amendments or poison pills serve as barrier to corporate control as these benefits and amendments causes barriers to making laws and governing them in a corporate. So proxy contest itself being a support mechanism to garner votes in the corporate mechanism do not form a barrier in corporate control.

5 0
3 years ago
Which form of investigation aims at checking whether or not a target system is subject to attack based on a database of tests, s
VikaD [51]

Answer:

<em>Empirical technical </em>research has a fundamental objective, which is to provide objective and independent information on the quality of the product to the interested party or stakeholder. It is one more activity in the quality control process.

Explanation:

Testing is basically a set of activities within software development. Depending on the type of tests, these activities may be implemented at any time during said development process. There are different software development models, as well as test models. Each one has a different level of involvement in development activities.

In a full penetration testing process, there are pre-instances to run this tool, but to take the first steps it is probably the best way to start. Nmap is a network scanning tool that allows you to identify what services are running on a remote device, as well as the identification of active computers, operating systems on the remote computer, existence of filters or firewalls, among others.

In simple words, when a server or device is going to be attacked, the attacker can carry out different attacks depending on the service: it is not the same to damage a web server, a database server or a perimeter router. Therefore, in any deployment, the first step will be to identify the services in the infrastructure, to decide how to proceed and, considering that in a penetration test the steps of an attacker are “imitated”, it will also be started in the same way.

5 0
4 years ago
Other questions:
  • Paragraph: Read the following two e-mail messages. In three to five sentences, explain why E-mail B is the more appropriate work
    5·1 answer
  • What is an efficiency target? Give an example of setting an efficiency target
    11·1 answer
  • Most OEMs recommend that the engine oil be replaced and a new filter installed at which of the following mileage intervals ?
    7·1 answer
  • John, the network administrator of XYZ Corporation, is interested in changing the format of text from the American Standard Code
    10·1 answer
  • What are some good invention names for an air filter?
    14·1 answer
  • What mass of nh3 can be made from 35g of n2?
    14·1 answer
  • Which of the following are personal video journal entries posted on the web? Select one: A. Podcasts B. Vlogs C. Blogs D. Newsgr
    14·1 answer
  • I’m not very good at using word because this is my second time using it lol
    8·2 answers
  • Voice of the customer, Social Media Analytics, churn analysis, survey analysis, and market research analytics are more likely to
    13·1 answer
  • Which three characteristics help identify a business opportunity? (Choose three)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!