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
snow_lady [41]
3 years ago
12

Exercise 4: Bring in program grades.cpp and grades.txt from the Lab 10 folder. Fill in the code in bold so that the data is prop

erly read from grades.txt. and the desired output to the screen is as follows: OUTPUT TO SCREEN DATAFILE Adara Starr has a(n) 94 average Adara Starr 94 David Starr has a(n) 91 average David Starr 91 Sophia Starr has a(n) 94 average Sophia Starr 94 Maria Starr has a(n) 91 average Maria Starr 91 Danielle DeFino has a(n) 94 average Danielle DeFino 94 Dominic DeFino has a(n) 98 average Dominic DeFino 98 McKenna DeFino has a(n) 92 average McKenna DeFino 92 Taylor McIntire has a(n) 99 average Taylor McIntire 99 Torrie McIntire has a(n) 91 average Torrie McIntire 91 Emily Garrett has a(n) 97 average Emily Garrett 97 Lauren Garrett has a(n) 92 average Lauren Garrett 92 Marlene Starr has a(n) 83 average Marlene Starr 83 Donald DeFino has a(n) 73 average Donald DeFino 73

Computers and Technology
1 answer:
Alex73 [517]3 years ago
3 0

Answer:

Here is the C++ program:

#include <fstream>  //to create, write and read a file

#include <iostream>  // to use input output functions

using namespace std;  //to access objects like cin cout

const int MAXNAME = 20;  //MAXNAME is set to 20 as a constant

int main(){  //start of main() function

ifstream inData;  //creates an object of ifstream class

inData.open("grades.txt");  //uses that object to access and opens the text file using open() method

char name[MAXNAME + 1];   // holds the names

float average;   //stores the average

inData.get(name,MAXNAME+1);  //Extracts names characters from the file and stores them as a c-string until MAXNAME+1 characters have been extracted

while (inData){  //iterates through the file

 inData >> average;  //reads averages from file using the stream extraction operator

 cout << name << " has a(n) " << average << " average." << endl; //prints the names along with their averages

 inData.ignore(50,'\n');  //ignores 50 characters and resumes when  new line character is reached. It is used to clear characters from input buffer

 inData.get(name,MAXNAME+1);}  //keeps extracting names from file

return 0; }

Explanation:  

The program is well explained in the comments added to each line of the code. The program uses fstream object inData to access the grades.txt file. It gets and extracts the contents of the file using get() method, reads and extracts averages from file using the stream extraction operator. Then program displays the names along with their averages from grades.txt on output screen.

The grades.txt file, program and its output is attached.

You might be interested in
An extranet is a business or organization's intranet that is partially accessible to authorized people outside the business or o
4vir4ik [10]

The statement is True.

When you want to share information from your intranet to people who are outside of your organization, you should use the extranet. Intranet differs from the extranet in that the former is a private network that is available only to members of an organization. Thus information found from the intranet cannot be accessed to the public, like the Internet.

7 0
4 years ago
Select all of the true statements about financial literacy. Financial literacy is the knowledge about money and what you do with
erastova [34]

The correct statements about financial literacy from the given options are as follows:

  • Financial literacy is the knowledge about money and what you do with money.
  • Financial literacy includes information about income, banking, loans, career, credit, and consumer rights.
  • One reason to become financially literate is to save you money.
  • One reason to become financially literate is to help you make smart financial decisions.

The only option that isn’t included is: <em>One reason to become financially literate is to make you rich</em>.  Though knowledge about financial literacy can help you in managing your finances, you would need great amount of knowledge about other fields to be able to become rich - not just financial literacy.


5 0
3 years ago
Which of the following detects unauthorized user activities, attacks, and network compromises, alerts of the detected attacks, a
Anit [1.1K]

The answer is IPS (Intrusion Prevention Systems)

The Intrusion Prevention Systems and Intrusion Detection Systems (IDS) are two security technologies that secure networks and are very similar in how they work. The IDS detects unauthorized user activities, attacks, and network compromises, and also alerts. The IPS, on the other hand, as mentioned, is very similar to the IDS, except that in addition to detecting and alerting, it can also takes action to prevent breaches.


3 0
3 years ago
which of the following formatting tools would i use if i really wanted a word to stand out in my document​
sweet-ann [11.9K]
You should change the font of that specific word to another colour. And you can also make it bold and italic. Furthermore, you may even italicize it and make the font larger.

Hope it helps :)
6 0
3 years ago
Which are methods used to improve reading fluency? Check all that apply. Practicing with a weak reader listening to a fluent rea
valina [46]

Answer:

listening to a fluent reader, developing vocabulary monitoring progress, reading a text once rereading a text

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • A table with a width set to 600 pixels will look ________ on a monitor with resolution set to 640 × 480 than on a monitor with r
    10·1 answer
  • Jenny wants to create an animated short video to add to her website. Which software will she use to create this animated video?
    14·1 answer
  • Which of the following is NOT true of constructors? Question 6 options
    14·1 answer
  • Dallas is an analyst at an online retailer. He is great at creating representative diagrams showing the relationships between cu
    12·1 answer
  • Who is the father of computer​
    12·2 answers
  • True / False<br> An instruction’s opcode generally indicates the number and type of its operands.
    5·1 answer
  • I need help 50 points and brainless if you answer
    7·1 answer
  • 1. The supervisory software of a computer is called _____ (a) operating system (b) high – level language (c) transistor
    5·1 answer
  • The field of ____ is concerned with the technical issues involved in information display. computer science
    14·1 answer
  • Your client Mr. Smith has requested a reservation at Eleven Madison Park this evening for a party of 2 at 6PM. Unfortunately, th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!