I have been doing a lot of reading and digging and not able to put together a away to do this. Here is my problem.

I am building a quiz program in C. I want it to pick at random from a list of questions and compare your answer to the correct answer and respond.

Is there a way to have each question followed by a list of four possible answers all in a text file that can be added to at any time and pull them from that instead of programing them in one by one.

I am planing on starting each question with (#) were # is the number of the question. I feel this will give the lowest error rate as to where each question starts because I can make sure that sequence is never repeated except when I want it.


I thank you in advanced for the information and will definitely credit this site and any users whom assist in any way with the completion of this project.

I Apologize for any repeating of questions on the forum I have dug deep in page by page and did not find anything like this but to error is human.

you could try reading the text then put the inputs in a 2D array then choose from there

Is there a way to have each question followed by a list of four possible answers all in a text file that can be added to at any time and pull them from that instead of programing them in one by one.

is the answers right next to the questions? meaning theyr'e in one line
you could try getting the whole line using fgets()then tokenize with space as the delimeter then save them in a 2D array

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.