I need it to loop back to the question, so they can get more questions.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace mathGame
{
class Program
{
static void Main(string[] args)
{
var rng = new Random();
int numberOne = rng.Next((int)1, (int)100);
int numberTwo = rng.Next((int)1, (int)100);
int decider = rng.Next(0, 3); // decides EVERYTHING
// operators
int addition = (numberOne + numberTwo);
int subtraction = (numberOne - numberTwo);
int multiplication = (numberOne * numberTwo);
int division = (numberOne / numberTwo);
// LIST
List<int> randomOperator = new List<int>(3);
randomOperator.Add(addition);
randomOperator.Add(subtraction);
randomOperator.Add(multiplication);
randomOperator.Add(division);
List<string> operatorName = new List<string>(3);
operatorName.Add("+");
operatorName.Add("-");
operatorName.Add("*");
operatorName.Add("/");
string sign = operatorName[decider];
int answer = randomOperator[decider];
Console.WriteLine("What's " + numberOne + sign + numberTwo);
var correct = Console.Read();
if (correct == answer)
{
Console.WriteLine("1");
}
else if (correct != answer)
{
Console.WriteLine("2");
}
}
}
}
When they get it correct/incorrect it will show a new equation. This is meant to be an infinite math game and I can't get it to display more than one equation, since it won't loop back to the question.
Aucun commentaire:
Enregistrer un commentaire