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
*** View this blog with HTTP instead of HTTPS to see the code formatted nicely. ***
Showing posts with label text. Show all posts
Showing posts with label text. Show all posts
Sunday, March 24, 2013
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
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
Wednesday, January 16, 2013
Simple File Manipulation in a Console Application with C++
1234567
1234567
1234567
and output it to a file called "output.txt" that is formatted like this (standard CSV (Comma Separated Values) format, except with 25 columns per row maximum):
1234567,1234567,1234567,...(25 times)
1234567,1234567,1234567,...(25 times)
1234567,1234567,1234567,...(18 times)
Thursday, November 29, 2012
Introduction to PHP for Website Developers
What is PHP? I could just have you visit php.net and find out for yourself, but although you would find out a lot of information about PHP you probably wouldn't really understand its use/purpose.
When you create a website using just HTML and CSS, it's "static". This means that no matter who accesses each page, all of the pages will look the same.
The reason for this is that with static web pages, the server simply regurgitates the same page (code) to each viewer. In most cases, you are going to want something better: a dynamic web page.
When you create a website using just HTML and CSS, it's "static". This means that no matter who accesses each page, all of the pages will look the same.
The reason for this is that with static web pages, the server simply regurgitates the same page (code) to each viewer. In most cases, you are going to want something better: a dynamic web page.
Tuesday, July 31, 2012
Using CSV (and Text) Files with D3
This tutorial is in response to a request by someone who wanted to know how to use data from CSV (Comma Separated Values) files with D3. Interestingly enough, you will also see how the data can be stored into and read from a simple text file (instead) along the way.
The CSV file format is commonly used in spreadsheets, and it's pretty well known to programmers as one of the easiest formats to read and write data with. Why? Take a look at what a CSV file's contents could be:
Before I show you how to use CSV, you should know that I made an "Introduction to D3" tutorial earlier. I highly recommend that you read it first.
The CSV file format is commonly used in spreadsheets, and it's pretty well known to programmers as one of the easiest formats to read and write data with. Why? Take a look at what a CSV file's contents could be:
2345, 345, sdfgsd, 3453,If you look past the stupidity of the bogus "data" I used in that example, you'll see that it's fairly simplistic! Every value is separated by a comma - hence, Comma Separated Values (CSV).
wgdg, 34, fsg, dgd, 34534.634,
sfsfggsdfgsdfgsdfh, 4, "hello",
-2
Before I show you how to use CSV, you should know that I made an "Introduction to D3" tutorial earlier. I highly recommend that you read it first.
Tuesday, May 22, 2012
Setting up Tables in a MySQL Database
When you're about to include a MySQL database in a project you're working on, you're going to want to plan ahead and figure out what kind of layout this database should use. After all, you can't use a database without first creating it!
You could start by creating this database's structure using PHP code, but it would be incredibly hard to get everything right the first time! My recommendation is to do what I always do: start out by using Adminer or PHPMyAdmin to view the database and structure it manually. Adminer and PHPMyAdmin are two of the most common PHP scripts that you can use to access your database without needing to write code. One or both of them are usually included somewhere in your CPanel - if you're using a CMS like WordPress, you should be able to find a plugin for one of them or something.
You could start by creating this database's structure using PHP code, but it would be incredibly hard to get everything right the first time! My recommendation is to do what I always do: start out by using Adminer or PHPMyAdmin to view the database and structure it manually. Adminer and PHPMyAdmin are two of the most common PHP scripts that you can use to access your database without needing to write code. One or both of them are usually included somewhere in your CPanel - if you're using a CMS like WordPress, you should be able to find a plugin for one of them or something.
Subscribe to:
Posts (Atom)