What is the code to make this in C#?
I am trying to do an console application. This application allows to user to prompt an input until user prompt the negative numbers. However, after an user typed a number, it terminates automatically. I want that the amount of value can be typed in the application in second time or third time until negative numbers. What is the code to make this in C#?
Kindest Regards
Re: What is the code to make this in C#?
have you tried the while loop ?
Re: What is the code to make this in C#?
I tried while, for loops and also if statment. But, all don't work.
Re: What is the code to make this in C#?
from the information that you share I suggest you write if(9 == -7) return +8....
can post some code, I don't feel like writing it from scrach today.
Re: What is the code to make this in C#?
Have you tried a for loop and an if statement together?
Otherwise, as a last resort may I suggest.
Code:
using (HelpFile doc = new HelpFile())
{
doc.Read();
}
Re: What is the code to make this in C#?
Seriously, here's some pseudo code....
Code:
while (true)
{
// read some input from the keyboard
// if it is a negative number then
// break (out of loop)
}
Re: What is the code to make this in C#?
Quote:
Originally Posted by
aprilzoom
I tried while, for loops and also if statment. But, all don't work.
A few suggestions...
1. Try and post the code that you've got so far. It would make it easier for others to help you.
2. Try and give us some indication of your background and ability/experience.
To me it seems like you don't understand the nature of Console applications. Basically you have to keep reading for input from the user. Once you stop reading input then your program executes and terminates. Here's a link to get you started...Console.ReadLine