Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы / С++.ЭТМО / 2 - Two tables / Lab3-2
.cpp#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