// dinam6.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
struct rec{
       int num;
       rec *p;};
void main()
   {rec *first,*q,*p;
    int i,n;
srand( (unsigned)time( NULL ) );
    first=new rec;
	first->p=NULL;
	 first->num=rand()/10000;
   puts("Input value n<=100 Chetnoe");
	 scanf("%d",&n);
	 p=first;
    for (i=1;i<n;i++){
       q=new rec;
       q->num=rand()/10000;
	   q->p=NULL;
	   p->p=q;     
       p=q;
       }
	puts("Spisok");
       q=first;
    while(q!=NULL){
       printf("%5d",q->num);
       q=q->p;}
	printf("\n");
    q=first;
	while(q->p!=NULL)
	{n=q->num;
	 p=q;
	 q=q->p;
	 if(n==q->num)
	 {p->p=q->p;
      delete(q);
	  q=p;
	 }
	}
  puts("New Spisok");
       q=first;
    while(q!=NULL){
       printf("%5d",q->num);
       q=q->p;}
	printf("\n");
  
 }