So, I'm starting C# in class. *Removed*
I'm trying to make a simple console application that asks the user 'do you like cheese?' and if the user types 'yes' it says 'Good, I like cheese too', and if the user types 'no', it continues and asks 'why not?'. Useless, but I usually do this kind of crap to learn the basics.
So far, I have:
Code:
using System;
namespace SampleNamespace
{
public class SampleClass
{
public static void Main()
{
// Write hello world to the console
System.Console.WriteLine("What is your name?");
string Name = System.Console.ReadLine();
System.Console.WriteLine("Hello " + Name + "!");
System.Console.WriteLine("Do you like cheese?");
string Answer = System.Console.ReadLine();
/*COMPARE?
switch (Answer.ToLower){
case 'yes':
--More questions here, like what kind of cheese and such
break;
case 'no':
--The usual
break;
default:
--"What did you say? (Prompt the previous question)
break;
}
*/
System.Console.WriteLine("Press any key to exit the application");
System.Console.Read();
} // End of Main function (program statup)
} // End of SampleClass
} // End of SampleNamespace
That's all fine and dandy, except I have no idea how to do the part commented out. That styling of (?) code would work in PHP, but it doesn't in C#. I get errors like 'too many characters in character literal', pointing to the 'case's.
Also, is there a way to restrict the user from only choosing "yes" or "no"?
I've looked, but this higher-level programming is confusing, when I'm used to PHP, which is turning out to be very different. With a quick look, C# looks like JavaScript (.Properties), but it's obviously more than that.
Thank you!
-PG
By the way, this isn't my homework or anything. I just hate learning at the speed of everybody else when I'm known in my classroom as the 'programmer' (oddly enough

must be the PHP). While the rest of my class 'learns' what variables are, I want to be doing something a little more advanced. I just don't like learning slowly

, I don't mean to sound arrogant or anything.