New line printing after accepting valid input

Hi, I'm having a couple problems writing this little bit of validation code. I basically want to validate whether it is an int value or a specific character that is being passed through.
The problem is that after I enter valid integer input, a blank line is being printed afterwards and I have to enter another value before it will go on in the loop, can anyone tell me what it is that I'm doing wrong in my code, any help would be appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int num[5]; 
    string store = "";
    
    for (int count = 0; count < 5; count++)
    {
        cout << "Enter a value: ";
        cin >> num[count];
        while(!(cin >> num[count]))
        {
            cin.clear();
            cin >> store;
            if(store == "*")
            {
                break;
            }
            else
            {
                cout << "Invalid input, try again: ";
                cin >> num[count];
            }
        }
        cout << endl;
    }
    system("PAUSE");
    return EXIT_SUCCESS;
}


Thanks again for any help.
You firstly ask to enter num[count] on line 15 and then on line 16. Therefore two numbers need to be entered. You can remove line 15.
I deleted line 15 like you said, but I'm still getting the same problem as before. any thoughts?
Oh, after looking at what you said again about requesting 2 numbers... I realized the else statement also requests new input as well... I made another change and now it's running smoothly again, thank you very much for the insight!
It's simple mistakes like these that I make all the time.
Topic archived. No new replies allowed.