//
// This loop is intended for an array with n elements. It tries to read
// n values into the array. If it fails early, it breaks from the loop.
//
// double data[n];
//
for ( int = 0; i < n; i++ ) {
cin >> data[i];
if ( cin.fail() ) break;
}
//
// i is the number of elements of data successfully read
//