Verify user input

Hi,

I need to verify (in a loop) that a user has input no more than 9 numbers and that it does not start with 0. Not sure where to begin on this.
1. Create a array of 9 elements
2. use for loop to store 9 input into the array
3. check if first input is equal to zero
4. if true, cout error message and exit
5. else continue inputting the numbers into array
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int num[9];
for(int i=0;i<9;i++)
{
  cout<<"Enter number "<<i+1<<" :";
  cin>>num[i];
   if(i==0 && num[i]==0)
   {
         cout<<"Your input cannot start with zero.program termiantes"<<endl;
          return 1;
          break;
    }
}
   
 
Topic archived. No new replies allowed.