C# label and goto -


This is my entire program. Obviously I am starting a new problem I am facing is that if age is zero If there is less then some rows come back, but the user has to ask for a PIN again. :( What can I do to fix this?

  using system namespace example {class program {static zero main (string [] args) {string name; string city ; Int age; int pin; // \ n is used for the line-break console. Type ("Enter your name:"); name = console.ReadLine (); console. Enter: "); city = console.ReadLine (); Age: Console. (" Enter \ N your age: "); age = int 32.exe (console.readline ()); console (" \ n Your p Enter: "); pin = int 32.perse (console) .ReadLine (); if (age> lie> 0> age> = 110) {goto age;} // printing message console / formatting output Consol E.WriteLine ("=============="); console.print line ("your full address:"); Console.WriteLine ("========== Console = brightness ("name = {0}", name); console.light line ("city = {0}", city); console.light line ("age = {0} ", Age); Console.light line (" pin = {0} ", pin); Console.WriteLine (" =============== "); Console.ReadLine (); }}}}  

So, if I It'm perfect sense, so if age is less than 0 or 110?

First of all, do not go with the label, they are ugly and you do not want to use them, instead you can loop while using, but there are many possibilities:

< P> In addition, instead of using \ n syntax, you can use the console. WrightLine

  string name; String City; Old age; Int pin; // \ n is used for the line-break console. Type ("Enter your name:"); Name = Console.ReadLine (); Console Type ("\ nEnclude your city:"); City = console Readline (); Age = -1; While (age and lieutenant; 0 || age & gt; = 110) {Console.Write ("\ nEnter your age:"); Age = Int32.Parse (Console.ReadLine ()); If (age and lieutenant; 0; age & gt; = 110) {Console.WriteLine ("Age should be between 0 and 110."); }} Console. Type ("\ nEnter your PIN:"); Pin = Int32.Parse (Console.ReadLine ()); // Console to send message to // print output console for console. WrightLine ("=============="); Console.light line ("your full address:"); Console.WriteLine ("============ \ n"); Console.light line ("name = {0}", name); Console.light line ("city = {0}", city); Console.light line ("age = {0}", age); Console.light line ("pin = {0}", pin); Console.WriteLine ("==============="); Console.ReadLine ();  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -