+ 1

how do I make the program run again after it executes from the console.

How do I make the program run again after it executes from the console? right now it executes successfully but I would like it to run again without close the console which is the only option it does now. Here is the code and below the last } what is shown at the console. using System.Collections.Generic; using System.Linq; using static System.Console; using static System.Convert; namespace flowControl1 { class Program { static void Main(string[] args) { WriteLine("if statement example."); Write("Enter a character: "); /* cast the unspecified input datatype to a character datatype */ char inputChar = System.Convert.ToChar(ReadLine()); char[] vowels = { 'a', 'e', 'i', 'o', 'u' }; /* here is the flow control */ if (char.ToLower(inputChar) == 'a') { WriteLine("Character " + inputChar + " is a vowel."); } else if (char.ToLower(inputChar) == 'e') { WriteLine("Character " + inputChar + " is a vowel."); } else if (char.ToLower(inputChar) == 'i') { WriteLine("Character " + inputChar + " is a vowel."); } else if (char.ToLower(inputChar) == 'o') { WriteLine("Character " + inputChar + " is a vowel."); } else if (char.ToLower(inputChar) == 'u') { WriteLine("Character " + inputChar + " is a vowel. "); } else { WriteLine("Character " + inputChar + " is not a vowel "); } ReadLine(); } } } C:\Users\cef19\source\repos\flowControl1\flowControl1\bin\Debug\netcoreapp3.0\flowControl1.exe (process 30980) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when

15th Nov 2019, 9:01 PM
Making A Change
Making A Change - avatar
2 odpowiedzi
+ 2
use a while loop bool again = true; While (again) { //the code } The loop will run the code between the braces as long as "again" is true. To stop the code make the variable "again" false. https://www.tutorialsteacher.com/csharp/csharp-while-loop please put the language you use in the tags.
15th Nov 2019, 9:08 PM
sneeze
sneeze - avatar
0
Thank you
16th Nov 2019, 1:40 AM
Making A Change
Making A Change - avatar