wuiyang

A guide to do your own math quiz

Aug 10th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. To do list if you don't know where to start:
  2. 1. Main menu that print selection for arithemetic operations [+ - or *] (for assignment specification: description I)
  3. 2. get user input for the option (use scanf())
  4. 3. second menu that select difficulty levels [beginner, intermediate, advanced] (for description II)
  5. 4. get user input for the option (use scanf())
  6. 5. have num1 = rand() % [number you want] (see line 135 for example)
  7. 6. have answer = num1 + num2 [or num1 - num2] (see line 139 for example, but if you just started, do + first then only do if else after step 8)
  8. 7. get user input and compare answer (see line 155 to 173)
  9. 8. do a for/while/do-while loop to give 10 questions (codes you coded in 5 to 7 should be inside the loop, or make it as a function, then call it like i did in line 59 to 62)
  10. 8.5. use if else or switch case to be able to get correct answer and print correct question if user choose - or *, line 139 to 152)
  11. 9. use if else or switch case to modify ranges [eg: beginner give number between 0-10, intermediate between 0-100] (see line 121 to 131)
  12. 10.use while/do-while loop to let the user able to get back to menu from in game if they select return to menu (line 51, 107, 108, 110 and 112)
  13. 11.use while/do-while loop to let the user able to get back to menu from level selection if they select return to menu (line 37 and 112)
  14. 12.finish things up, make your codes clear and readable, and make sure the format is right
  15. eg: dont do this
  16. if(A){
  17. if(B){
  18. dosomething();
  19. }
  20. else if(C){
  21. donothing();
  22. }
  23. }
  24.  
  25. or this
  26. if(A){
  27. if(B){
  28. dosomething();
  29. }
  30. else if(C){
  31. donothing();
  32. }
  33. }
  34.  
  35. do this
  36. if(A){
  37. if(B){
  38. dosomething();
  39. }
  40. else if(C){
  41. donothing();
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment