tixaxavier

Prominent
Nov 11, 2017
2
0
510
0
hey there guys! I really need help...
so, I need a program that reads some specific lines and prints other ones from a file. also, i need to compare an input with another specific lines from a file. I have a written file with information for playing a little game. on the 1st line I have a char 'e', 'm' or 'h' wich matches the difficulty the user chose previously (easy, medium or hard). the 2nd line has a math question, the 3rd has the correct answer for it, and the 4th has a letter 'I', 'P', 'C' or 'A' wich i have to return to the user only if he aswers correctly. In every 4 lines I have the information regarding each question.
So, I need to only show the questions that match the chosen difficulty, then I need to compare the user answer with the correct one and if he answers correctly, I return the corresponding letter. I also need to store the correct user's answers so that I stop the game whenever he reaches the word "IPCA", so he will need to answer the questions with the matching letters. Until the user doesn't get all the letters, the questions keep going. Please, I really need this! :/
 

tixaxavier

Prominent
Nov 11, 2017
2
0
510
0
I don't know how to compare the right asnwer with the user answer inside a function, cause I can't do it on the main function. And I also need help at reading 4 by 4 lines, also inside a fuction (not main). I only had 2 classes of files in C and I need to do this until tomorrow and I can't solve this parts.
I already have a function wich tells if the user won the game or not and another one that prints the question on the screen as well as the menu for choosing the difficulty and other things
 

ASK THE COMMUNITY