Dr.Ebrahimi.com

 

Testing a Data File

Hello and I hope you are doing well. Module 2 assignments are very interesting where you start to see the power of the programming and that would be a great experience for you. Please try to experiment it  them by yourself as much as you can and that would be a way to understand data bases and even Google.

There are two ways that you can do it and I prefer the first at this time.

  1. By redirection “<” in the cmd mode   c:\my documents \testdatafile.exe< testdatafile.in

Please refer to the end of chapter 3 on topic of Dos or Unix commands.

 

By using the file stream inside the program and please look at the Question Q3e at the end of chapter 3. In addition, I have dedicated  chapter 9-   file handling  to this cause.

The easiest way to link your executed program to a data file is by going to cmd (command mode) and simply use a redirection (I got so excited when I personally learned this and It was a best gift for me).  

Here is help with using a data file in your program

  1. Type the program the same way you are doing interactively and save it as testdatafile.cpp.  Test your program for correctness by typing the data interactively
  2. Make a data file like making a program but choose =>new=>file=> resource and name it  as testdatafile.in