Hey guys please help me out on this program in C# I really don't have idea on this..plss:(?
program that would input the value of variable REPLY and then output its corresponding meaning.
REPLY -- MEANING
Y -- Yes,let's do it!
N -- No,I won't do it!
M -- Maybe I will!
S -- Sure dude!
Q -- Exit Program!
----------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example
{
class Program
{
static void Main(string[] args)
{
}
}
}
1
Expert's answer
2012-07-19T07:24:32-0400
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Example { class Program { static void Main(string[] args) {
Console.Write("REPLY: "); char REPLY = Char.Parse(Console.ReadLine()); Console.WriteLine("REPLY -- MEANING"); switch (REPLY) { case 'Y': Console.WriteLine("Yes,let's do it!"); break; case 'N': Console.WriteLine("No,I won't do it!"); break; case 'M': Console.WriteLine("Maybe I will!"); break; case 'S': Console.WriteLine("Sure dude!"); break; case 'Q': Console.WriteLine("Exit Program!"); break; } } } }
Comments
Leave a comment