C# point system is not working.

  • Thread starter Thread starter KipkesZijnGeil
  • Start date Start date
K

KipkesZijnGeil

Guest
static void Main(string[] args)
{

Ja(0);
}

static void Ja(int point)
{
Random numbergenerator = new Random();
Random numbergenerator2 = new Random();
int num01 = numbergenerator.Next(1, 11);
int num02 = numbergenerator.Next(1, 11);
int antwoord = num01 + num02 + numbergenerator2.Next(-1, 1);

Console.WriteLine(num01 + "+" + num02 + "=" + antwoord);
int answer = Convert.ToInt32(Console.ReadLine());

// the point system is not working...


{
if (num02 + num01 == antwoord)
{
if (answer == 1)
{

Ja(point++);
}
else
{
Console.WriteLine("Game Over " + point);
}

}

else
{
if (answer == 0)
{

Ja(point++);
}
else
{
Console.WriteLine("Game Over " + point);
}
}

}

Console.ReadLine();

}


I know the reason that it doesn't work. becus it is a loop and the int "point" always return to 0 but how to fix this? How to make a point system in this case that it don't become 0 at the end.

Continue reading...
 
Back
Top