hey guys i wrote a code for honework problem...the code works fine however everytime user puts more number than the static array it keep those number in the memory and later in the program if i do cout and cin it will ignore that and assign the number to the variable from the memory. Is it possible to delete all the extra input from the memory. For example my array has a maxvalue of 10 and if user enters 11 numbers it would keep that one number in memory and later when i try to do cout and ask the user to input a number it will automatically assign the 11th number???

You are asking about how to flush and discard the input stream of all its contents. Narue wrote this thread some time ago that explains how to do that.