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
11111nata11111 [884]
3 years ago
7

Your program must output each student’s name in the form: last name followed by a comma, followed by a space, followed by the fi

rst name; the name must be left justified. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls.
Engineering
1 answer:
Reptile [31]3 years ago
3 0

Answer:

#include <iostream>

#include <string>

#include <fstream>

using namespace std;

char getStudentGrade(int testScore);

//Declare constant max students in file 10

const int maxStudents = 10;

struct StudentType

{

  string studentFName;

  string studentLName;

  int testScore;

  char grade;

};

void readStudentData(StudentType students[]){

  int i = 0;

 

  ifstream infile;

  infile.open("inputStudentData.txt");

 

 

  while (!infile.eof())

  {

   infile >> students[i].studentFName;

   infile >> students[i].studentLName;

   infile >> students[i].testScore;

   students[i].grade = getStudentGrade(students[i].testScore);

      i++;

  }

}

char getStudentGrade(int testScore){

  char grade;

  if(testScore >= 80) {

      grade = 'A';      

  }

  else if(testScore >= 60) {

      grade = 'B';

  }

  else if(testScore >= 50) {

      grade = 'C';  

  }

  else if(testScore >= 40) {

      grade = 'D';      

  }

  else {

      grade = 'F';  

  }

  return grade;

}

int main()

{

 

  StudentType students[10];

 

  readStudentData(students);

 

  for(int i=0;i<maxStudents;i++) {

      students[i].grade = getStudentGrade(students[i].testScore);

  }

 

  for(int i=0; i<maxStudents; i++){    

      cout << students[i].studentLName <<", " << students[i].studentFName << " " << students[i].grade << endl;

  }

  ofstream outputFile;

  outputFile.open ("outputStudentData.txt");

 

  for(int i=0; i<maxStudents; i++){    

      outputFile << students[i].studentLName <<", " << students[i].studentFName << " " << students[i].grade << endl;

  }

  outputFile.close();

  return 0;

}

You might be interested in
A 5000-lb truck is being used to lift a 1000-lb boulder B that is on a 200-lb pallet A. Knowing that the truck starts from rest
artcher [175]

Answer:

Explanation:

Total weight being moved = 5000+1000+200

= 6200 lb .

Force applied = 700 lb

= 700 x 32 = 22400 poundal .

acceleration (a) = 22400 / 6200

= 3.613 ft /s²

To know velocity after 6 ft we apply the formula

v² = u² + 2as

v² = 0 + 2 x 3.613 x 6

43.356

v = 6.58 ft/s

4 0
2 years ago
Coal fire burning at 1100 k delivers heat energy to a reservoir at 500 k. Find maximum efficiency.
Marizza181 [45]

Answer:

<em>55%</em>

Explanation:

hot reservoir = 1100 K

cold reservoir = 500 K

<em>This is a Carnot system</em>

For a Carnot system, maximum efficicency of the system is given as

Eff = 1 - \frac{Tc}{Th}

where Tc = temperature of cold reservoir = 500K

Th = temperature of hot reservoir = 1100 K

Eff = 1 - \frac{500}{1100}

Eff = 1 - 0.45 = 0.55 or<em> 55%</em>

7 0
2 years ago
Find the remaining trigonometric functions of 0 if
garik1379 [7]

Answer:

cosΘ=−√558

tanΘ=−3√5555

cscΘ=83

secΘ=−8√5555

cotΘ=−√553

8 0
2 years ago
Isormophous phase diagram
shusha [124]

Answer:

Phase diagrams represent the relationship between temperature and the composition of phases present at equilibrium. An isomorphous system is one in which the solid has the same structure for all compositions. The phase diagram shown is the diagram for Cu-Ni, which is an isomorphous alloy system.

Hope it help you friend

6 0
3 years ago
A DC generator turns at 2000 rpm and has an output of 200 V. The armature constant is 0.5 V-min/Wb, and the field constant of th
WITCHER [35]

Answer:

b. 10A

Explanation:

Using the formula, E= k × r×I

200= 0.5 ×2000×0.02×I

200=20×I

Dividing with 20

I = 200/20= 10A

4 0
3 years ago
Read 2 more answers
Other questions:
  • If a torque of M = 300 N⋅m is applied to the flywheel, determine the force that must be developed in the hydraulic cylinder CD t
    13·1 answer
  • A rotating cup viscometer has an inner cylinder diameter of 2.00 in., and the gap between cups is 0.2 in. The inner cylinder len
    9·1 answer
  • Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x miles per hour and car B tr
    9·1 answer
  • A stream of air enters a 7.00-cm ID pipe at a velocity of 30.0 m/s at 27.0°C and 1.80 bar (gauge). At a point downstrream, the a
    15·1 answer
  • Air expands through an ideal turbine from 1 MPa, 900 K to 0.1 MPa, 500K. The inlet velocity is small compared to the exit veloci
    10·1 answer
  • The air velocity in the duct of a heating system is to be measured by a Pitot-static probe inserted into the duct parallel to th
    13·1 answer
  • A 4-pole, 3-phase induction motor operates from a supply whose frequency is 60 Hz. calculate: 1- the speed at which the magnetic
    10·1 answer
  • Cryogenic liquid storage. Liquid oxygen is stored in a thin-walled spherical container, 96 cm in diameter, which is further encl
    10·1 answer
  • Think about the KIA factory shown in the video, what are two things that managers could do to reduce waste or increase efficienc
    6·1 answer
  • Algorithm for sum 2+4+6+….+n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!