Thread: Question about one dimensional array

1. Question about one dimensional array

how can i get the largest and smallest value that i input if i input 10 integers?

thank you...new in programming

2. If you had a deck of cards that you could only go through one by one, a piece of paper, and a pencil, how would you do the same task?

3. As recommended, what would you do? If someone asks you: how much money would you want from this list: \$1, \$0, \$100, \$50, \$1000, \$42, how do you determine your answer? Do you just look at the first one? Just the last one? Just the, say, middle one? Do you look at all of them?

For any general list (or array), there is only one solution. KISS.

4. Originally Posted by nadroj
For any general list (or array), there is only one solution. KISS.
This should apply to ALL programming tasks.

Anyway, use a for loop and a variable of the same type as the array set to the lowest possible value, then compare and update that variable, if appropriate, in the loop.

5. Originally Posted by MK27
This should apply to ALL programming tasks.
What part? Having a single, unique solution to all general programming tasks? Or the "KISS" principle? I just mentioned "KISS" to him/her because I imagine he/she is just starting out with this sort of thing, and we often tend to overthink or overcomplicate things when starting to learn them. It was my way of saying "dont think too hard about this problem, as you will see when you get it it is a simple solution."

6. The KISS principle.

I guess that implies there often really is one "best" solution (the simplest one). I just think it's a great principle that's worth keeping in mind esp. when programming. Of course, what simple means is ambiguous -- maybe a combination of efficiency and productivity. "Productivity" takes into account that what is simple to one person can be impossible to another. Since you are unlikely to forget who you are, that makes KISS pretty simple to apply most of the time.

Popular pages Recent additions