-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsep 13th
49 lines (46 loc) · 2.04 KB
/
sep 13th
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
namespace ConsoleApp1
{
class Program
{
static void Main()
{
Console.WriteLine("Welcome to the Online Gaming Forum!");
string name;
int age;
Console.Write("Enter your name: ");
name = Console.ReadLine();
Console.WriteLine("How old are you, {0}?", name);
age = int.Parse(Console.ReadLine());
Console.WriteLine("Let's play a game, {0}", name);
Console.WriteLine("I will guess a number between 1 and 100");
Console.WriteLine("All you need to do, {0}, is say whether my number is closer to 1 or 100", name);
Console.WriteLine("If you win, {0}, you will get a fabulous prize!", name);
for(int i=0; i < 5; i++) //int exit = 0; while (exit!=-1)
{
Console.WriteLine("Ok, {0}, Let's Go! Enter your GUESS. Enter either the number 1 or 100, {0}", name);
//Console.WriteLine("Ok, {0}, Let's Go! Enter your GUESS. Enter either the number 1 or 100, or Enter -1 to exit ", name);
int player_number = int.Parse(Console.ReadLine());
Random rnd = new Random();
int computer_guess = rnd.Next(1, 100);
Console.WriteLine("Here is my Number, {0}:{1}", name, computer_guess);
if(computer_guess<50 && player_number == 1)
{
Console.WriteLine("Player WINS!!!");
give_Advice(name, age);
}else if(computer_guess>=50 && player_number == 100)
{
Console.WriteLine("Player Wins!!!");
}
else
{
Console.WriteLine("Player Loses");
}
}
}
private static void give_Advice(string name, int age)
{
Console.WriteLine("As to your Prize - Honestly, {0}, at the Sweet Age of {1}, you should know better than to believe vague promises...", name, age.ToString());
}
}
}