Computer Science Canada Help for how to read more than one line from text file with intergers in it. |
Author: | xBloodyHeartx [ Mon Mar 04, 2013 12:41 pm ] | ||
Post subject: | Help for how to read more than one line from text file with intergers in it. | ||
What is it you are trying to achieve? I am trying to read more then one line from a text file into my program. What is the problem you are having? It reads the last line only and makes sure the random number generated doesn't match that which it does when it outputs to the screen, but it still shows the first line from the file in my output when generating the numbers to the screen. My text file has and shows in notepad like this 2 4 3 4 I know how to write to a file and add to existing file as well. Describe what you have tried to solve this problem I have tried searching through this forums and google search as well, but still can't get it to read from the first line make sure it doesn't match before going to next line to make sure it doesn't match either. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using Turing 4.1.2 |
Author: | Tony [ Mon Mar 04, 2013 3:18 pm ] |
Post subject: | Re: Help for how to read more than one line from text file with intergers in it. |
xBloodyHeartx @ Mon Mar 04, 2013 12:41 pm wrote: I am trying to read more then one line from a text file into my program. It does read more than one line. That's how it gets to the last line... That is, then you open a file, the reading starts at the beginning. Also Quote: for linez2h4l : 1 .. upper (lines2h4l) loop loop loop What? This seems awfully complicated. When you use exit, how do you keep track which of the 4 nested loops actually terminates? |
Author: | xBloodyHeartx [ Mon Mar 04, 2013 6:41 pm ] |
Post subject: | RE:Help for how to read more than one line from text file with intergers in it. |
okay. Tony then where should i open the file in order it to read the numbers in that file making sure from first line to end of file it doesnt generate random numbers that are equal to those numbers in the file? i want it to work for every line in that file not just the last line, because it still outputs the numbers on the first line from the file on the screen. It shouldn't at all. |
Author: | xBloodyHeartx [ Mon Mar 04, 2013 6:43 pm ] |
Post subject: | RE:Help for how to read more than one line from text file with intergers in it. |
Also Tony trying to put that if statement for it to not equal from generated numbers to the numbers in the file. |
Author: | Tony [ Mon Mar 04, 2013 8:07 pm ] |
Post subject: | RE:Help for how to read more than one line from text file with intergers in it. |
Alright, where in the program are you reading data from a file? What action does the program execute immediately after reading the first line of input? Talk about that in detail, it should point you towards the answer to your questions. |
Author: | xBloodyHeartx [ Tue Mar 05, 2013 10:58 am ] |
Post subject: | RE:Help for how to read more than one line from text file with intergers in it. |
So, Tony it will work though right? i just have to figure out what you said to find my answer cause i don't want to switch to c/c++ one of my friend is saying so that he can help me lol. He doesn't know turing. I chose turing because it was fast to write one and simple then c/c++. |
Author: | Insectoid [ Tue Mar 05, 2013 8:53 pm ] |
Post subject: | RE:Help for how to read more than one line from text file with intergers in it. |
Quote: He doesn't know turing.
If he's a half-decent programmer capable of doing anything in C++, it won't matter that you're using Turing. |