hey everyone!

I have being going over it for days now and still have no idea what the mistake is, can you help me? please!

Last edited on
Hello natyconde,

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.

Andy
Hello natyconde,

Without having the actual input file to work with I cannot test the program. It does compiles for me even though I see some problems.

In main you define a variable “fileName” as a 2D array. The name “filename” is somewhat misleading. “story” might be a better name. Then you send the 2D array to “readFile()” and it receives a copy of “fileName” a 2D array. Yet in “readFile()” you are storing you information in what appears to be a 1D array. It did not give e a compile error, but I do not think it will work right.

Then in “readFile()” you define the variable “fileName” s a char array. If your compiler is set to compile with the c++11 standard “filename would work better as a “std::string” type. And this is a better place to use the name “filename”. Then in the while loop it looks like you are trying to input into a 1D array when “story” is a 2D array. If it works I do not believe it will work the way you think it will.

This is what I have found for now. Without being able to run th program and test it, it is hard to figure out what does not work. The input file or an idea of what is in the file would help.

Hope that helps for now,

Andy
I think this would be a simple example of an input file - however it may take something bigger to thoroughly test the program.

<name> went for a walk in the park. <he_or_she>
found a <noun>. <name> decided to take it home.
Topic archived. No new replies allowed.