Hi everyone
I need to write some code for an assignment, that involves reading from a text file using C.
I've tried to read through previous discussions but am really struggling to understand them. I'm not very strong in programming so wondered if anyone with some patience is able to give me a very simple explanation as to how to do this?
I have created a text file that looks like this:
0 12
1 24
2 34
3 55
etc...
and ive instructed my programming to general 10 numbers randomly.
What I need to know, is how to I then take those 10 random numbers, and find their corresponding number in the text file, and then give the corresponding number back.
The 10 Randomly Generated Number's are in an array, so I need a second array with the corresponding values (e.g. if the first 3 randomly generated numbers were 2, 2, 0 then the corresponding numbers would be 34, 34, 12).
I'm really struggling on how to access the text file, take and maniupulate the data and then input it into my new array. once im able to do this, im able to do the rest, so any advice or input will be greatly appreciated. please note i can only use C, not C++ and I'm not a programmer, Im studying Electrical and Electronic Engineering so need to have a basic grasp of C programming only, so am unable to follow complicated discussions and articles.
Thank you in advance for your help
all the best