Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
14
Добавлен:
17.04.2013
Размер:
830 б
Скачать
#include <iostream.h>
#include <math.h>
#include "List.h"

List tabOpen[7];
int tabClose[7];

int h(int x) { return x%7; }

void addclosetable(int x)
{
	int pos=h(x);
	while(true)
	{
		if(tabClose[pos]==0)
		{
			tabClose[pos]=x;
			break;
		}
		pos++;
		if(pos>6) pos=0;
	}
}

void PrnCT()
{
	for(int i=0; i<7; i++)
	{
		cout<<tabClose[i]<<" ";
	}
	cout<<endl;
}

void main()
{
	int x=0;
	for(int j=0; j<7; j++) tabClose[j]=0;
	
	cout<<"Enter unsigned numbers more than zero: "<<endl;

	for(j=0; j<7; j++)
	{
		cin>>x;
		tabOpen[h(x)].Add(x);
		addclosetable(x);
	}

	cout<<"----------------------------------------------"<<endl;
	
	for(x=0; x<7; x++)
	{
		tabOpen[h(x)].PrnList();
	}
	
	cout<<"----------------------------------------------"<<endl;

	PrnCT();
	cin>>x;
}
Соседние файлы в папке 2 - Two tables