Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a program that takes an expected input file named input.txt of this format in C++ with SEPARATE FILES THAT ARE THEN RUN BY A

write a program that takes an expected input file named "input.txt" of this format in C++ with SEPARATE FILES THAT ARE THEN RUN BY A MAIN EXECUTABLE. do not use namespace std: (int),(int),(int) (string) (int),(int),(int) (string) (int),(int),(int) (string) (int),(int),(int) (string) (int),(int),(int) (string) There will be a line with exactly three integers, separated by commas with no spaces There will be no trailing comma on the integer lines The next line will be a string. It might be a single word, or it may be an entire phrase or sentence There might be any number of lines, but they will always come in that pattern There will not be any missing lines or values You can count on the integers all being legitimate integer values 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 NOTE: you may add a trailing comma to the end of the line if that is easier for you. You might want to use a stringstream for data-handling. Recall that the getline function allows you to set a delimiter, but it only returns string values. You may 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.

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

Students also viewed these Databases questions