0

Hi,
I am looking for ideas regarding an automated calculator (so to speak) that will be able to generate 10 RANDOM questions for a console application. The mathematic funtions needed are addition, subtraction and multiplication and the numbers involved (by random selection) must not exceed 12.
Also, if possible, a function will be needed to declare whether or not the inputted answer is correct or not.

Can you help?

2
Contributors
1
Reply
7
Views
2 Years
Discussion Span
Last Post by SalmiSoft
0

You need to become familiar with the Random function. Use it to pick the values you wish to calculate with. Also use it to select a mathematical function; generate a random number from 0 to 2 and use this to specify which of your 3 mathematical functions to use. An enumerated type listing the 3 mathematical functions could be useful.

You also need to get the correct symbol for the mathematical function you select. Maybe hold the three possibilities in an array with the mathematical function as the array index.

You would then have all the elements you need to display the question. You can also do the same calculation to check the user's answer.

All that would remain would be generating 10 questions. A simple FOR loop would do this, generating 1 question each time round the loop.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.