Lotto program doesn't stop
- by Naseyb Yaramis
So I'm making a lotto game. You have to enter 6 lucky numbers and if they're the same as the lotto numbers then you win.
Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OefeningExaam
{
class Program
{
static void Main(string[] args)
{
Random getal = new Random();
int[] lottotrekking = new int[6];
Console.WriteLine("Geef je geluksgetallen in <tussen 1 en 42>");
Console.WriteLine("Geef je eerste getal in");
int getal1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Geef je tweede getal in");
int getal2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Geef je derde getal in");
int getal3 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Geef je vierde getal in");
int getal4 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Geef je vijfde getal in");
int getal5 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Geef je zesde getal in");
int getal6 = Convert.ToInt32(Console.ReadLine());
while (getal1 != lottotrekking[0] || getal2 != lottotrekking[1] || getal3 != lottotrekking[2] || getal4 != lottotrekking[3] || getal5 != lottotrekking[4] || getal5 != lottotrekking[4] || getal6 != lottotrekking[5])
{
for (int i = 0; i < lottotrekking.Length; i++)
{
int cijfer = getal.Next(1, 43);
lottotrekking[i] = cijfer;
Console.WriteLine(lottotrekking[0] + "\t " + lottotrekking[1] + "\t " + lottotrekking[2] + "\t " + lottotrekking[3] + "\t " + lottotrekking[4] + "\t " + lottotrekking[5]);
}
}
if (getal1 == lottotrekking[0] && getal2 == lottotrekking[1] && getal3 == lottotrekking[2] && getal4 == lottotrekking[3] && getal5 == lottotrekking[4] && getal5 == lottotrekking[4] && getal6 == lottotrekking[5])
{
Console.WriteLine(lottotrekking[0] + " " + lottotrekking[1] + " " + lottotrekking[2] + " " + lottotrekking[3] + " " + lottotrekking[4] + " " + lottotrekking[5]);
}
Console.ReadLine();
}
}
}
The problem is that the program just keeps going and doesn't stop. It's supposed to stop when the lucky numbers are the same as the lotto numbers.