TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tristian Jong
NA
12
2k
Please help Fixing My Error (THNX)
Jul 14 2019 6:59 AM
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);
}
}
Reply
Answers (
8
)
Can anyone help me to write Code for finding Critical path?
Rename image in c#