don't get the logic? .....

I have an assignment that asks me to make an encoder. the encoding itself is simple, and I get that. However, my instructor wants me to read something from a txt file using cin, and not hard wire the file. Basically, I am asking the user to enter the file they want to be encoded. To me, it seems like this last bit is logically impossible. How can you read something from a file that is essentially being "created" by the user (i.e. cin creates the file, so theoretically there is nothing in the file to encode!)? I can post the assignment, but I am having a hard time with this logic... I know how to do this program with a hard wired value, but I am not allowed to do that..Any help would be great. thanks in advance!
I have 3 files on my computer (I am a very simple man) called one.txt two.txt and three.txt (again, very simple man). Seeing as these are the only 3 files on my computer, I store everything in them, and they are not empty, and quite large.

What your instructor wants is for the program to launch, and ask me which file I want to encode, I type in two.txt, and then BAM! two.txt is unreadable.

1
2
3
4
//instead of
infile.open ("test.txt", ifstream::in);
//do this
infile.open (stringTheUserEntered, ifstream::in);
so i should assume the file is on the computer, but that only the user knows what file should be open? (in this case, encoded)
Last edited on
Topic archived. No new replies allowed.