Writing a C++ program.

I am attempting to write a C++ program.

It needs to read string data from a file, find the same string within that file multiple times and creates a newline after each occurrence. Also from the begging of the file, numbers the lines sequentially from 1 to ? till end of file.

...example...
(sample file)
something something ,something something / something 09/17/2015 , something something ,something something / something 10/27/2015 , something something ,something something / something something something ,something something / something 11/11/2015

(and save it into another file as)
something something ,something something / something 09/17/2015
something something ,something something / something 10/27/2015
something something ,something something / something something something ,something something / something 11/11/2015

I was thinking of using the string "2015" as the find value that is searched for.

Any help would be appreciated. Thank you.
First you need to read in the search text from the console - for example 2015.
The you start to read the file line by line. If the line contains 2015 replace with 2015\n and write it to the output file. If not write the original line to the output.

Topic archived. No new replies allowed.