-4

So I tryed to make a simple text game.And I wanted to do Yes/No dialong I was trying to figure this out for 2 hours, but i didn't find any solution to my problem. I'm total beginner, so I don't know much about coding.

I was trying to achive it trough "bool" bot it wasnt the right option. Obviousli.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace TEXTRPG

{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("Greetings, stranger.");

            Console.ReadKey();

            Console.WriteLine("I've came here to give you a quest.");
            Console.ReadKey();
            Console.WriteLine("Do you accept?");
            //Yes/No
            Console.ReadKey();
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445

1 Answers1

0

Here is my sample

do {
        Console.Write("Do you accept? [y/n] ");
        response = Console.ReadKey(false).Key;
        if (response != ConsoleKey.Enter)
            Console.WriteLine();
    } while (response != ConsoleKey.Y && response != ConsoleKey.N);
phucnh
  • 1,020
  • 6
  • 14