Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- namespace lottery
- {
- class Program
- {
- static Task Main(string[] args)
- => Start(args);
- static async Task Start(string[] args)
- {
- bool playing = true;
- while (playing)
- {
- Random r = new Random();
- int[] random_numbers = new int[6] { r.Next(0, 70), r.Next(0, 70), r.Next(0, 70), r.Next(0, 70), r.Next(0, 70), r.Next(0, 25) };
- int[] numbers = new int[6];
- List<int> winning_numbers = new List<int>();
- Console.WriteLine("Do you want to use quick pick, yes or no");
- String answer = Console.ReadLine();
- if (answer.ToLower() == "yes" || answer.ToLower() == "y")
- {
- for (int y = 0; y < 5; y++)
- {
- numbers[y] = r.Next(0, 70);
- }
- numbers[5] = r.Next(0, 25);
- }
- else
- {
- for (int x = 0; x < 6; x++)
- {
- // Debuging: Tells you winning number
- Console.WriteLine(random_numbers[x]);
- Console.WriteLine($"Please input your {x + 1} number");
- numbers[x] = Convert.ToInt32(Console.ReadLine());
- }
- }
- String total = "0";
- int matches = 0;
- for (int i = 0; i < 5; i++)
- {
- if (random_numbers[i] == numbers[i])
- {
- if (matches == 0)
- {
- total = "10";
- }
- else
- {
- total += "0";
- }
- winning_numbers.Add(random_numbers[i]);
- matches++;
- }
- }
- if (random_numbers[5] == numbers[5])
- {
- if (matches == 0)
- {
- total = "1";
- }
- total = total.Replace('1', '5');
- total += "0";
- winning_numbers.Add(random_numbers[5]);
- matches++;
- }
- if (matches == 0)
- {
- Console.WriteLine("YOU LOSER");
- }
- else
- {
- foreach (int num in numbers)
- {
- Console.Write(num + " ");
- }
- Console.WriteLine();
- foreach (int num in winning_numbers)
- {
- Console.Write(num + " ");
- }
- Console.WriteLine();
- Console.WriteLine($"You've made {matches} matches and won ${total}");
- }
- Console.WriteLine("Would you like to play again, yes or no");
- String replay = Console.ReadLine();
- if (replay.ToLower() == "no" || replay.ToLower() == "n")
- {
- playing = false;
- }
- }
- }
- }
- }
- // 1 = 10; 2 = 100; 3 = 1000; 4 = 10000; 5 = 100000; 6 = 1000000;
- // special changes first 1 to 5;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement