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]
2 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]2 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
In a complex system, many subsystems interact with one another. How do these systems interact in terms of inputs and outputs?
Artemon [7]

Answer:

I think in there transmission you know inputs into ports like for their own

Explanation:

likeslike Spanish and is obviously inputs and outputs their portsinto the portsdifferent ports you know

4 0
2 years ago
Click/press _______ to remove the most recently typed text.
bagirrra123 [75]

Answer:

ctrl Z

Explanation:

ctrl Z is the shortcut for undo it will reverse the last thing you did ctrl Y is redo if i accidently did ctrl Z i can do ctrl Y. Hope this helps!

6 0
3 years ago
Write a function called is_present that takes in two parameters: an integer and a list of integers (NOTE that the first paramete
Agata [3.3K]

Answer:

The function in python is as follows

def is_present(num,list):

    stat = False

    if num in list:

         stat = True

       

    return bool(stat)

Explanation:

This defines the function

def is_present(num,list):

This initializes a boolean variable to false

    stat = False

If the integer number is present in the list

    if num in list:

This boolean variable is updated to true

         stat = True

This returns true or false        

    return bool(stat)

7 0
3 years ago
_____ is a markup language designed to transport and store data on the Web. Group of answer choices Standard Generalized Markup
Kisachek [45]

<u>Extensible Markup Language (XML)</u> is a markup language designed to transport and store data on the Web.

Explanation:

  • Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable
  • Extensible means that the language is a shell, or skeleton that can be extended by anyone who wants to create additional ways to use XML.
  • Markup means that XML's primary task is to give definition to text and symbols.
  • It is a textual data format with strong support, Unicode for different human languages.
  • Extensible Markup Language (XML) is used to describe data.
  • The design goals of XML emphasize simplicity, generality, and usability across the Internet.
  • It is a text-based markup language derived from Standard Generalized Markup Language (SGML).
4 0
2 years ago
Which of the following is another term for a subfolder?
Tomtit [17]
Another term for a subfolder is a 

"D" Child folder. 

A child folder is like an inner version of a root folder, just like a subfolder is to a root folder. 

I hope this helps!
~kaikers

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which step of creating a financial budget involves listing the payroll, rental, and utility costs?
    10·2 answers
  • There are many modes of remote visual communication. Which is the most common mode?
    10·2 answers
  • Word provides an undo button that can be used to cancel the most recent command or action. true or false.
    10·2 answers
  • OSHA requires training for employees on the hazards to which they will be exposed.
    12·2 answers
  • Sum.Write a program that prompts the user to read two integers and displays their sum.Your program should prompt the user to rea
    11·1 answer
  • FIGURE A-1—Use the information in this chart to answer Question 1.
    6·1 answer
  • An information system interacts with its environment by: A. processing data. B. XML protocols. C. receiving data. D. systems ana
    10·1 answer
  • Why use LinkedIn automation for LinkedIn?
    10·1 answer
  • Megan owns a small neighborhood coffee shop, and she has fifteen employees who work as baristas. All of the employees have the s
    13·1 answer
  • 9- Write a program in MARIE to add three numbers.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!