Preview:
#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;
 }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter