Finding the hidden numbers

Pages: 12
Well, change the while loop reading from stream in to a for loop reading from cin however many values you want.
I have no idea of what you are saying
@Dee5, do you know what a "for" loop is? (If not, you should learn that first: there is a handy tutorial on this site).

Then, can you get that for loop to read in 10 successive strings from cin ( i.e., user input)?

For each of the strings read in during that loop you can do what is currently in the while loop.

If you have more than one word per line, or if you have something other than precisely 10 lines, then YOU will have to decide what should signal the end of the input.
Last edited on
for (in i=1; i<=10; i++)
Something like that?
Something like that?
int i, not in i. Otherwise OK (for fixed number 10 inputs).
Sorry again, so what if I want the user to input the number of items he wants to input and then that will be the limit
Like the program ask the user on the first line that limit
Topic archived. No new replies allowed.
Pages: 12