Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this lab is to familiarize you with the C++ process of parsing and file input/output through the basics of the fstream library.

The purpose of this lab is to familiarize you with the C++ process of parsing and file input/output through the basics of the fstream library. The getline function will be used to manipulate large pieces of data into progressively smaller chunks. Together with the stringstream function, you can swap back and forth to 'tokenize' a large line of input and control where each piece goes. Your job is to write a program that takes an expected input file named "input.txt" of exact format: (int),(int),(int) (string) (int),(int),(int) (string) (int),(int),(int) (string) (int),(int),(int) (string) (int),(int),(int) (string) Your program should then sum the ints of each line and output the immediately following line's string that many times seperated by commas such that: 1,2,3 ham becomes: ham,ham,ham,ham,ham,ham You will also find the atoi() and .c_str() functions useful. Your final output format should not be the console. Instead, your program should open a second file and write your output to a file named "output.txt" which should be five lines of comma-seperated words. Final deliverable is one .cpp file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions