Sunday, March 24, 2013

Comparing and Filtering through Lists of Data

In this tutorial, similarly to the Comma Adder Tutorial, we will be reading in data and then modifying it for output into another file.

However, this time, there will be another file of data that we will compare it with. We will remove duplicates from our output, and we will keep track of those duplicates and output them to another file. So, if our input for the first file is this:

1234567
2345678
3456789

and our input from the second file is this (I've colored the duplicate blue):

8573968
3958396
1234567
3058376

Our first output file will be this (with duplicate(s) removed):

2345678
3456789

and our second output file will be this (the duplicate(s)):

1234567

Thursday, March 7, 2013

Comma Adder

In a similar fashion to my 2 previous tutorials:

http://thecodingtutorials.blogspot.com/2013/01/simple-file-manipulation-in-console.html
http://thecodingtutorials.blogspot.com/2013/01/character-arrays-in-c.html

This tutorial will show a C++ program that takes input from a file called "input.txt" and outputs it to "output.txt", only this time, it will take input like this:

1234567
1234567
1234567

and output it with commas after the third digit on each line like this:

123,4567
123,4567
123,4567