Question: Your job is to create a program that takes in a standard text ( . txt ) file and converts that to a CSV (

Your job is to create a program that takes in a standard text (.txt) file and converts that to a CSV
(.csv) file. Each item will be designated by an individual item per line in the text file. Well define
when you should have a new line in the CSV file by an exit character: -1. So, assume each item
is moving horizontally in the CSV, until the exit character which will move the file down.
So, the following sample text file:
1
2
-1
3
4
-1
Would be translated to a CSV file as:
1,2
3,4
Your program should, take in a base filename (WITHOUT AN EXTENSION), open that filename
with .txt added and verify the existence in a loop. Once you have a valid file, read the contents
into a vector and close the input file. Then, open an output file of the input filename with .csv
added and write the contents of the vector appropriately.
Your program should end with the following files existing:
filename.txt
filename.csv
A couple sample text files have been provided to use

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!