-4
static void Main(string[] args)
{
    Program obj = new Program();
    Console.WriteLine("Press 1 for PackMan 2 Ghost and 3 for AC FSM");
    string input = Console.ReadLine();

    //if (input == "1")
    //{
    obj.Packman();
Kenneth K.
  • 2,889
  • 1
  • 21
  • 29

1 Answers1

-1

If you're taking inputs as this

Console.WriteLine("Press 1 for PackMan 2 Ghost and 3 for AC FSM");

Then

You should try using switch case it will work

static void Main(string[] args) 
{ 
    Program obj = new Program();

    Console.WriteLine("Press 1 for PackMan 2 Ghost and 3 for AC FSM");
    string input = Console.ReadLine();

    Boolean exit= false;

    While(!exit){
        Switch (input)
        {
            case 1 :
                obj.Packman();
                break;
            case 2: 
                break;
            case 3: 
                break;
            case 4:
                Exit= true
        }
    }
}
Chris Dunaway
  • 10,623
  • 2
  • 35
  • 46
Prathm
  • 1
  • 1
  • When posting code, please format it appropriately so it is easy to read. Also, make sure it compiles. Your code as listed does not compile. – Chris Dunaway Sep 19 '19 at 20:21