Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

ISBN: 0782125395, 9780782125399

More Books

Students also viewed these Databases questions