I'm trying to prompt the use to enter up to ten integers, then print them back out on the screen. If the user enters -1, the program should only print what the user entered, and then will go on to the next step. Right now, this code runs, but if I try to use -1, it still prints 10 numbers on the screen, but anything after that is just random numbers. Can anyone help me?
What does this mean? garbage or spurious memory addresses are output?
what happens if after line 25 you write if(numValues==-1)break;
EDIT: by itself this does nothing.
size_t is defined in the <cstring> header however am not familiar with why it is required.
If the declaration of numValues is given a type int , the break code above is included and counter is substituted for maxValues in line 33 and the <cstring> header is included the program seems to behave. You may be able to establish why.
You are looping through all the array. if you don't initialise a variable, then it will hold garbage.
I don't understand what this means. Forgive me if I sound dumb, I am fairly new at this and extremely confused. What varialbe needs to be initialized? I