mercredi 2 septembre 2020

How to reset the data receive from the user to the Variable Char after Loop

`

    char AS = 'N';
      do
      {
        Console.Write("\nDo you want to Add another Subject[Y/N]: ");
        char add = Convert.ToChar(Console.ReadLine().ToUpper());

    

    if (add == 'Y')
        {
                AS = 'Y';
        }


  } while (AS == 'N');`

I received a problem from the system "The string must be one character" after the loop. How can I reset the data input in variable char named "add". Thank you

Aucun commentaire:

Enregistrer un commentaire