The first solution for the Rolodex problem is based on the C++ string class. Furthermore, it's much easier to test the program as we write it rather than waiting until it's finished. If we test the program throughout development, we know that any new problems are likely to be in the newest code added. That means that there are fewer places for bugs to hide. Once we verify a logical group of statements, we can rely on the following code more confidently.
Do this part before copying rolodex.txt into the project folder.
The first step is opening the file and detecting when an error occurs. We write just enough code to complete these two tasks.
Now, copy rolodex.txt into the project folder.
Parsing input is a rather complex and error-prone operation. If there is a problem with the program, it would be a shame to focus our attention on the parsing operation only to discover the problem was in the code reading the file. So, we write code that demonstrates that the program can read the file. However, this code is NOT part of the final program and must be removed or commented out of the final program.