Question: The first is the problem. The last three are exaples that were given. X Replit - Week9_demo3 Replit - Week9_demo1 X Repl.it - Week9_demo2 _resource/content/13/1ab9PartAInstructions.pdf

The first is the problem. The last three are exaples that were given.  The first is the problem. The last three are exaples that
were given. X Replit - Week9_demo3 Replit - Week9_demo1 X Repl.it -
Week9_demo2 _resource/content/13/1ab9PartAInstructions.pdf 1/11 100% + 10 CS 161 Lab 9 . The
objective of this lab is to introduce you to reading from and
writing to text files. This information is not covered in your textbook

X Replit - Week9_demo3 Replit - Week9_demo1 X Repl.it - Week9_demo2 _resource/content/13/1ab9PartAInstructions.pdf 1/11 100% + 10 CS 161 Lab 9 . The objective of this lab is to introduce you to reading from and writing to text files. This information is not covered in your textbook but is covered in the required resources and is discussed in Mari's Week 9 - Getting Started" Screencast - https://drive.google.com/file/d/19e6-JzV2- TKBa9_HZMOPLITCONDMON8/view?usp=sharing Part A As you watch the video, complete the demonstration programs with the instructor and submit a word processing or pdf document containing the source code from main.cpp for Design and implement a program that reads each line in a text file, processes the line and then produces output both on the console and in another text file. Each line in the file contains a set of integers followed by a space. The first integer is the number of numbers in the rest of the line. The last line in the file contains just the number and should be used only to stop the program. The program should sum all of the integers in the line (with the exception of the first number) and should output each individual number as well as the sum. Change the program above to include a function for reading and processing one line in the file. The function should take an istream& as its parameter. (it's ok to output just to the console in the function. If you decide to output to a file in the function, you'll need a second parameter which is an ofstream&). The function should return a bool indicating that it processed a line in the file successfully or that the line contained just the sentinel value o Main should open the file and check that the file opened successfully before calling the function within a loop, o i X Replit - Week9_demo2 Repl.it - Week9_demo3 Replit - Week_demo1 s for Education NEW Edit in wor! #include #include using namespace std; 5 int main() 7 //ifstream reader("numbers3.txt"); -8 ifstream reader; 9 reader.open("numbers3.txt"); 20 ofstream writer("output.txt"); 13 if ( freader) if ( lreader.good) 11 writer.good)) 15 - 16 cout > number if (number 1.0) 27 cout > number; if (number 10 ) { cout > values sum value; cout return 0; About Created on Nov 20, 2020 Itupun diction Forks Replit - Weeks demo x X Replit - Week_demo2 Reptit - Week9 demo3 Clons Set current workin oderno3 #main.cpp Slog Pricing Jam Teams for Education NEW COIN Workspace ON 2 3276 6135.9 12 10 268 main.cpp 1 numbers 3.xt Doutput About Forks 1 ALIENWARE Reput - Week9 demo Replit - Week_demo2 X Culon Set current workin X Replit - Week_demos demo3emain.cpp Blog Pricing Jam Teams for Education NEW COTHI Wonopac WE CODE 1 2 main.cpp There are going to be a valors read and sunned 2.76 15 There are going to be 6 values read and sumed 1359 12 10 10 Lumbers 5 7 output.txt There are going to be 2 values read and sured 8-14 10 About 2013 Sign up to con Forks IT ALTEN WARE X Replit - Week9_demo3 Replit - Week9_demo1 X Repl.it - Week9_demo2 _resource/content/13/1ab9PartAInstructions.pdf 1/11 100% + 10 CS 161 Lab 9 . The objective of this lab is to introduce you to reading from and writing to text files. This information is not covered in your textbook but is covered in the required resources and is discussed in Mari's Week 9 - Getting Started" Screencast - https://drive.google.com/file/d/19e6-JzV2- TKBa9_HZMOPLITCONDMON8/view?usp=sharing Part A As you watch the video, complete the demonstration programs with the instructor and submit a word processing or pdf document containing the source code from main.cpp for Design and implement a program that reads each line in a text file, processes the line and then produces output both on the console and in another text file. Each line in the file contains a set of integers followed by a space. The first integer is the number of numbers in the rest of the line. The last line in the file contains just the number and should be used only to stop the program. The program should sum all of the integers in the line (with the exception of the first number) and should output each individual number as well as the sum. Change the program above to include a function for reading and processing one line in the file. The function should take an istream& as its parameter. (it's ok to output just to the console in the function. If you decide to output to a file in the function, you'll need a second parameter which is an ofstream&). The function should return a bool indicating that it processed a line in the file successfully or that the line contained just the sentinel value o Main should open the file and check that the file opened successfully before calling the function within a loop, o i X Replit - Week9_demo2 Repl.it - Week9_demo3 Replit - Week_demo1 s for Education NEW Edit in wor! #include #include using namespace std; 5 int main() 7 //ifstream reader("numbers3.txt"); -8 ifstream reader; 9 reader.open("numbers3.txt"); 20 ofstream writer("output.txt"); 13 if ( freader) if ( lreader.good) 11 writer.good)) 15 - 16 cout > number if (number 1.0) 27 cout > number; if (number 10 ) { cout > values sum value; cout return 0; About Created on Nov 20, 2020 Itupun diction Forks Replit - Weeks demo x X Replit - Week_demo2 Reptit - Week9 demo3 Clons Set current workin oderno3 #main.cpp Slog Pricing Jam Teams for Education NEW COIN Workspace ON 2 3276 6135.9 12 10 268 main.cpp 1 numbers 3.xt Doutput About Forks 1 ALIENWARE Reput - Week9 demo Replit - Week_demo2 X Culon Set current workin X Replit - Week_demos demo3emain.cpp Blog Pricing Jam Teams for Education NEW COTHI Wonopac WE CODE 1 2 main.cpp There are going to be a valors read and sunned 2.76 15 There are going to be 6 values read and sumed 1359 12 10 10 Lumbers 5 7 output.txt There are going to be 2 values read and sured 8-14 10 About 2013 Sign up to con Forks IT ALTEN WARE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!