Here is a simple piece of code. actually it is a "fill array" function code.

```
#include <iostream>
 using namespace std;
int main(){ 
   int size = 10; a[10]; numberUsed;
   cout << "Enter up to " << size << " nonnegative whole numbers.\n"
   << "Mark the end of the list with a negative number.\n";
   int next, index = 0;
   cin >> next;
   while ((next >= 0) && (index < size)){
      a[index] = next;
      index++;
      cin >> next;
   }
  numberUsed = index;
  for(int i = 0 ; i < numberUsed -1 ; i++){
 cout << a[i]  << endl;
  }
}

```

it works fine when user enters integers. But when i enter double values it should trancate that particular value. and repeats that value for the next entered integers also.
so now for input 1 2 3 4 5 6.5 7 8 9 -1 .I get the following output
1
2
3
4
5
6
6
6
6
6
Any help will be appreciated.