What's the best way to terminate this program using either “q” or “Q” or “quit” or “QUIT”?

Assuming there aren't any other bugs in your program... just add a couple lines like this.

Assuming there aren't any other bugs in your program... just add a couple lines like this: using System; class Class1 { STAThread static void Main(string args) { string userName; string line; int I = 0, totalCal = 0, cal = 1; Console. WriteLine("Welcome to the magical calorie counter! "); Console.WriteLine(); Console.

Write("Enter in your name -> "); userName = Console.ReadLine(); for (i = 0; I : "); line = Console.ReadLine().ToLower(); if (line == "q" || line == "quit") { break; } else if (!int. TryParse(line, cal)) { Console. WriteLine("Not a valid option.

Please try again. "); continue; } Console. WriteLine("You entered {0}", cal); Console.WriteLine(); totalCal += cal; Console.WriteLine(); Console.

WriteLine("-------------------So far you have a total of {0}------------------", totalCal); Console.WriteLine(); Console.WriteLine(); }// end of while }// end of amin }.

Ahhhh, wrong loop to start with, but I see how that works. Thanks Mark. – Chris Sep 17 '10 at 5:00 then make it while(true) instead.

+1 or a checkmark would be nice. – Mark Sep 17 '10 at 5:15 mark, I need 15 rep to give you a check mark, anything other way I could do it? – Chris Sep 17 '10 at 6:06 @Chris: Really?

Thats kind of dumb... well I just gave you 10 pts, so.. I guess you'll have to wait for the other 2 :p Fill out your profile to get 100 I think. – Mark 15 mar1 at 23:45.

I think exit, or quit is fine. Or you can accept e or q.

I would prefer a keyboard shortcut a keyboard savvy user may already know, like Ctrl+W, which is the default key for closing tabs on modern web browsers.

1 And i'd prefer that a console app act like a console app, not Firefox or Chrome or whatever. Keyboard shortcuts aren't just a pain to type and remember; they just don't make sense in a program like this, and add complexity to the reading of input. – cHao Sep 17 '10 at 4:51.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions