Help! I'm new to C# and keep getting stuck on things which should be pretty simple
Can anyone tell me why this loop repeats the output found in the menu( ) 3 times when a number is entered?
Also, while on the subject of console programs what is the best way to clear the console?Code:class Tester { private const int MAX_BOOKS = 5; static private Book[] library = new Book[ MAX_BOOKS ]; /* Book[] Library { get { return library; } } */ /// <summary> /// The main entry point for the application. /// </summary> /// static int menu( ) { Console.WriteLine( "There are {0} books in the library", library.Length ); Console.WriteLine( "Please enter and option:" ); Console.WriteLine( "1. Enter book details" ); Console.WriteLine( "2. Display book details" ); Console.WriteLine( "5. Exit" ); return Console.Read( ); } [STAThread] static void Main( ) { int choice; do { choice = menu( ); switch( choice ) { case '1': for( int i = 0; i < library.Length; i++ ) { } break; case '5': Console.WriteLine( "Exiting...." ); break; default: Console.WriteLine( "Invalid choice. Please try again." ); break; } }while( choice != '5' ); } }