#include<iostream> using namespace std; int main() { int arr[10] = {0},key,c,d,ch=1; //k = key, c = collision, d = data for(int i=0; i<=9 ; i++) { cout<<" "<<arr[i]; } while(ch==1) { cout<<"\nEnter Key"; cin>>key; c = 0; d = key % 10; for(int i=0;i<=9;i++) { if(arr[d]>0) { d++; c++; } } arr[d] = key; for(int i=0;i<=9;i++) { cout<<arr[i]<<endl;; } cout<<"\nCollisions: "<<c; cout<<"Do you want to continue: "; cin>>ch; } return 0; }