program.cs(43.61): Error CS1003 Syntax Error, ',' expected
I am getting an error that I can't seem to fix. Please help me.
- using System;
- using SplashKitSDK;
- public enum MenuOption
- {
- TestName = 0,
- GuessThatNumber = 1,
- Quit = 2,
- }
- public class Program
- {
- static void TestName()
- {
- string name = "bobby";
- Console.WriteLine("Please Enter Your Name " + name);
- Console.WriteLine("Hello " + name);
- if (name.ToLower() == "Tristian" )
- {
- Console.WriteLine("Welcome my creator!");
- }
- else if (name.ToLower() == "jake")
- {
- Console.WriteLine("G'day Jake!");
- }
- else if (name.ToLower() == "bobby")
- {
- Console.WriteLine("G'day Bobby");
- }
- }
- private static int ReadGuess(int min, int max)
- {
- int userGuess;
- do
- {
- Console.WriteLine("Enter your guess between " + min " and " + max);
- userGuess = Convert.ToInt32(Console.ReadLine());
- } while(userGuess < min || userGuess > max);
- return userGuess;
- return (MenuOption)(userGuess -1);
- }
- public static void RunGuessThatNumber()
- {
- int target;
- int guess = 0;
- int lowGuess = 1;
- int highGuess = 100;
- target = new Random().Next(100) +1;
- Console.WriteLine("Welcome to guess that number!");
- Console.WriteLine(target);
- while(guess != target)
- guess = ReadGuess(lowGuess, highGuess);
- if (guess < target)
- {
- Console.WriteLine("Your guess is too low!");
- lowGuess = guess;
- }
- if (guess > target)
- {
- Console.WriteLine("Your guess is too high!");
- highGuess = guess;
- }
- else
- {
- Console.WriteLine("Well done! you have guess the number!");
- }
- }
- private static MenuOption ReadUserOption()
- {
- int option;
- Console.WriteLine("1 Will run test name, 2 Will play guess that number, 3 Will quit ");
- do
- {
- Console.Write("Choose an option [1-3]: ");
- try
- {
- option = Convert.ToInt32(Console.ReadLine());
- }
- catch
- {
- Console.WriteLine("That is not a valid option. Please try again.");
- option = -1;
- option = Convert.ToInt32(Console.ReadLine());
- }
- } while (option < 0 || option > 4);
- return (MenuOption)(option - 1);
- }
- public static void Main()
- {
- MenuOption userSelection;
- do
- {
- userSelection = ReadUserOption();
- Console.WriteLine(userSelection);
- switch (userSelection)
- {
- case MenuOption.TestName:
- TestName();
- break;
- case MenuOption.GuessThatNumber:
- Console.WriteLine("GuessThatNumber...");
- break;
- case MenuOption.Quit:
- Console.WriteLine("Quit...");
- break;
- }
- } while (userSelection != MenuOption.Quit);
- }
- }
Tristian JongPosted Jul 15, 2019, 8:01 AM
Rajanikant HawaldarPosted Jul 14, 2019, 9:05 AM
Rajanikant HawaldarPosted Jul 14, 2019, 9:02 AM
Tristian JongPosted Jul 14, 2019, 8:48 AM
Thank you for trying to help. I edited the code, but I still get the same error.
Program.cs(43,65): error CS1003: Syntax error, ',' expected [C:\Users\trist\OneDrive\Bureaublad\2019\SIT771\WeekThree\Code1\NameTester\nameTester.csproj]
Sanwar RanwaPosted Jul 14, 2019, 8:05 AM
Rajanikant HawaldarPosted Jul 14, 2019, 7:14 AM
Rajanikant HawaldarPosted Jul 14, 2019, 7:06 AM
Rajanikant HawaldarPosted Jul 14, 2019, 7:05 AM