c# - How do you loop Readline statements? -


I have homework work and I'm stuck on a certain part of the question. How do I make a Loop number about the readline statement?

In other words, suppose I have two numbers which I want to input. Instead of typing the readline statement twice, how do I get a loop which will allow me to type the readline statement once?

There are two numbers that I want to input, instead of typing the readline statement twice , how do I get a loop do, which I once Reedlain statement will allow you to type

well, if you want to number two, you're going to have two variables (or an array ), So I think you are trying to change it:

  int firstNumber; Int secondNumber; FirstNumber = int.Parse (console.readline ()); SecondNumber = int.Parse (console.readline ());  

In something like this:

  int [] myNumbers = new int [2]; (Int i = 0; i & lt; 2; for i ++) (myNumbers [i] = int.Parse (Console. Reedlain ());}  

But it Think:

  • Will the signal be identical for both numbers? Or there will be immediate changes between inputs
  • Whether the array / Is it easy to calculate?
  • The numbers in the structure's benefits should be in my other parts. App (looping to get an amount, etc.)

I think That a loop Okay, unless you end up with the logic inside that loop, you are using again:

  int [] myNumbers = new int [2]; (int i = 0; i & lt; 2; i ++) for {if i == 0 // prompt bad string = "Enter first number" prompt other string = "Enter the second number"; Console.WriteLine (shortly ); MyNumbers [i] = int.Parse (console .readlines ());}  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -