Click here to Skip to main content
15,891,698 members
Home / Discussions / C#
   

C#

 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
DavodM9-Sep-09 22:33
DavodM9-Sep-09 22:33 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 22:39
Sivyo9-Sep-09 22:39 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
DavodM9-Sep-09 22:53
DavodM9-Sep-09 22:53 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 23:05
Sivyo9-Sep-09 23:05 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
DavodM9-Sep-09 23:18
DavodM9-Sep-09 23:18 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 23:23
Sivyo9-Sep-09 23:23 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 23:12
Sivyo9-Sep-09 23:12 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
DavodM9-Sep-09 23:23
DavodM9-Sep-09 23:23 
Im guessing you had been round the for loop a couple of times before you put the right input in?

I would suggest scrapping the user input code and starting again, sometimes its easier than fixing something.

You might want to break it down into smaller chunks, i.e get the input and store as a string, then try parsing it to an int and then if that works add it to the array, if not ask the user again. Repeat the above 3 times and bingo!

The code will be more verbose but it will be easier to debug and understand and once you have it working you can always go back over it and refactor it.

Terse code can look better but it can also be hard to understand and maintain.
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 23:31
Sivyo9-Sep-09 23:31 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
DavodM9-Sep-09 23:35
DavodM9-Sep-09 23:35 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 23:39
Sivyo9-Sep-09 23:39 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo10-Sep-09 12:06
Sivyo10-Sep-09 12:06 
Questioninfo on Evidence class Pin
manustone9-Sep-09 19:59
manustone9-Sep-09 19:59 
AnswerRe: info on Evidence class Pin
SeMartens9-Sep-09 21:28
SeMartens9-Sep-09 21:28 
QuestionHow to access Cache Data Pin
sjs4u9-Sep-09 19:52
sjs4u9-Sep-09 19:52 
AnswerRe: How to access Cache Data Pin
SeMartens9-Sep-09 21:34
SeMartens9-Sep-09 21:34 
GeneralRe: How to access Cache Data Pin
sjs4u9-Sep-09 22:01
sjs4u9-Sep-09 22:01 
Questionwrapper to use C++ library in C# Pin
flyakiteosx9-Sep-09 19:25
flyakiteosx9-Sep-09 19:25 
AnswerRe: wrapper to use C++ library in C# Pin
Sindicoro9-Sep-09 20:35
Sindicoro9-Sep-09 20:35 
GeneralRe: wrapper to use C++ library in C# Pin
flyakiteosx9-Sep-09 22:02
flyakiteosx9-Sep-09 22:02 
GeneralRe: wrapper to use C++ library in C# Pin
DaveyM699-Sep-09 22:14
professionalDaveyM699-Sep-09 22:14 
Questionparameters Pin
mjawadkhatri9-Sep-09 19:07
mjawadkhatri9-Sep-09 19:07 
AnswerRe: parameters Pin
Christian Graus9-Sep-09 19:10
protectorChristian Graus9-Sep-09 19:10 
AnswerRe: parameters Pin
Mycroft Holmes9-Sep-09 19:45
professionalMycroft Holmes9-Sep-09 19:45 
Questionin a DataGridView can each row bind to a different custom data source ((BindingList)) ? Pin
alladeen9-Sep-09 17:09
alladeen9-Sep-09 17:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.