for int number int check while check cout Array cin arr getchar arr if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
for(int i=0;i<number;i++)
{
int check = 0;
while(check==0)
{
cout << "Array[" << i << "] ";
cin >> arr[i];
k=getchar(arr[i]);
if (k<48 || k>57)
{
cout << "Input correctly!";
}
if(k<48 || k>57)
{
check++;
}
}
}