Shrek Has Swag
New member
Hey guys, this is my first post so dont go hard on me. I'm a complete rookie and i am one of the worst programmers you'll ever see.
So my code wont start, it doesn't do anything until you quit, it then prints out the first line of code.
FYI: I code on Mac and Windows, this was written on Mac and works there but doesn't on Windows. The code is in Dutch.
This is the code:
So my code wont start, it doesn't do anything until you quit, it then prints out the first line of code.
FYI: I code on Mac and Windows, this was written on Mac and works there but doesn't on Windows. The code is in Dutch.
This is the code:
C#:
using System;
namespace TestApp
{
class MainClass
{
public static void Main(string[] args)
{
// Hier vraagt vanaf en tot welke getallen hij moet gebruiken.
Console.WriteLine("Vanaf welke nummers wil je oefenen?");
int Vrgnum1 = Convert.ToInt32 (Console.ReadLine());
Console.WriteLine("Tot welke nummers?");
int Vrgnum2 = Convert.ToInt32 (Console.ReadLine());
Random rnd = new Random();
Start:
int num01 = rnd.Next(Vrgnum1, Vrgnum2);
int num02 = rnd.Next(Vrgnum1, Vrgnum2);
// De rekenmachine dingen
Console.WriteLine("Hoeveel is " + num01 + " keer " + num02 + "?");
int antwoord = Convert.ToInt32 (Console.ReadLine());
if (antwoord == num01 * num02)
{
int reactie = rnd.Next(1, 4);
switch (reactie)
{
case 1:
Console.WriteLine("Goed zo, dat klopt!");
break;
case 2:
Console.WriteLine("Dat is waar, goed gegokt ;)");
break;
case 3:
Console.WriteLine("Goed gedaan!");
break;
case 4:
Console.WriteLine("Lekker bezig!");
break;
}
}
else
{
// Hij reageert gebaseerd op hoe dichtbij je was.
int diff = Math.Abs(antwoord - (num01 * num02));
if (diff == 1)
{
Console.WriteLine("Bijna!");
}
else if (diff <= 10)
{
Console.WriteLine("Je kan het wel, nog even oefenen!");
}
else {
Console.WriteLine("Je komt niet eens dichtbij...");
}
}
Console.WriteLine();
Console.WriteLine("Wil je nog een som doen?");
Console.ReadKey();
Console.Clear();
Goto Start;
}
}
}