I would recommend reading the following thread for detailed explanation on why cin is better to be used in while loop.
[15.2] Why does my program go into an infinite loop when someone enters an invalid input character?
another thing if you want to break on the size of array.. why don't you use. the for loop?
for (int i=0; i<10; ++i)
cin >> c;
a[i] = c;