
Q1: Are we supposed to create a file for the program to open? Q2: What the program is suppose to be opening? Q3: What are ifstream and ofstream supposed to be reading and writing in? Q4: How do we know it wrote the file the way we want to it be written?
Q1: Are we supposed to create a file for the program to open? A1: Yes you can type in any file (like using vi) to test your program. OR "p9.in" is available to you in "Assignments/p9.in". The actual input by the autograder.
Q2: What the program is suppose to be opening? Q2: Look at your I/O Streams handout page 2, top program example. The open() member function is being invoked by the object "ifs" type ifstream , "ifs.open( infile );" . "infile" is the name of the file you type in when you run this program as you have the answer in Q1 above, "Assignments/p9.in".
Q3: What are ifstream and ofstream supposed to be reading and writing in? A3: Read in from "infile" which is entered as "Assignments/p9.in" Write to file "outfile" which is entered as whatever you want e.g "p9.out" (Not suggested to write over your old program names "p1.C".
Q4: How do we know it wrote the file the way we want to it be written? A4: Type "more p9.out" or "cat p9.out" or "vi p9.out" to look at the contents of a file.