Click here to Skip to main content
15,907,687 members
Home / Discussions / C#
   

C#

 
AnswerRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
OriginalGriff9-Sep-09 21:37
mveOriginalGriff9-Sep-09 21:37 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 21:45
Sivyo9-Sep-09 21:45 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
SeMartens9-Sep-09 21:48
SeMartens9-Sep-09 21:48 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
Sivyo9-Sep-09 21:57
Sivyo9-Sep-09 21:57 
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:03
Sivyo9-Sep-09 22:03 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
SeMartens9-Sep-09 22:08
SeMartens9-Sep-09 22:08 
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:10
Sivyo9-Sep-09 22:10 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
OriginalGriff9-Sep-09 21:58
mveOriginalGriff9-Sep-09 21:58 
I'm betting it doesn't do it "the whole time" - just about 100 times!
I think if you put a similar Console.WriteLine into the "boolSet[intSet[i]] = true" part of the if statement, then it will not happen often. Why? Because your input data is nearly all negative or greater than 100.

Do you know how to use the debugger? If so then put a breakpoint on the "boolSet = new bool..." line, and single step you way round the loop a few times - see what you have in the data, and what your code it doing with it. It is well worth getting used to the debugger, it will save you a lot of time in the future!

P.S. you don't need the "this." part of "this.boolSet = new bool..." - it is implied and makes the code harder to read... It's not wrong to include it, but it isn't needed and you will find out later why you can do it.

No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.

This message is made of fully recyclable Zeros and Ones

GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
OriginalGriff9-Sep-09 22:02
mveOriginalGriff9-Sep-09 22:02 
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:11
Sivyo9-Sep-09 22:11 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
SeMartens9-Sep-09 22:12
SeMartens9-Sep-09 22:12 
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:14
Sivyo9-Sep-09 22:14 
GeneralRe: User Input Into Array, Need To Check Array Member If It Is Greater Then 100 Or Less Then 0 Pin
SeMartens9-Sep-09 22:19
SeMartens9-Sep-09 22:19 
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:21
Sivyo9-Sep-09 22:21 
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 
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 

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.