У нас: 141825 рефератів
Щойно додані Реферати Тор 100
Скористайтеся пошуком, наприклад Реферат        Грубий пошук Точний пошук
Вхід в абонемент


delete ");

int ch;

scanf("%d",&ch);

pnew = man->next;

if (man->index == ch) man->for_delete = 1;

else

do

{

if (pnew->index == ch)

{

pnew->for_delete = 1;

break;

}

pnew = pnew->next;

}while(pnew);

FILE *to;

if ((to = fopen("P.dat","w+")) == NULL)

{

printf("Error of opening file with data\n");

getch();

exit(1);

}

fseek(to,0,0);

while(man)

{

fprintf(to,"%d %s %d %d %d\n",cnt,man->surname,man->count,man->heaver,man->for_delete);

man = man->next;

cnt++;

}

fclose(to);

}

//------------------------------------analysis function____________________________

void analysis(void)

{

clrscr();

FILE *to;

if ((to = fopen("PA.dat","a")) == NULL)

{

printf("Error of opening file with data\n");

getch();

exit(1);

}

for_PA *el;

el = new for_PA;

el->surname = new char [15];

fseek(to,0,0);

luggage *man;

man = new luggage;

man->surname = new char [15];

luggage *pm;

pm = new luggage;

pm->surname = new char [15];

int ind = 1;

int all = 1;

man = form();

pm = man->next;

printf("%d - %s\n",ind,man->surname);

man->index = ind;

while(pm)

{

++ind;

printf("%d - %s\n",ind,pm->surname);

pm->index = ind;

pm = pm->next;

}

printf("\nPoint number of surname: ");

int ch;

scanf("%d",&ch);

el->count_more_two = 0;

el->common = 0;

el->middle = 0;

float mddl = 0;

if (man->count > 2) ++el->count_more_two;

el->common = man->heaver;

pm = man->next;

while (pm)

{

if (pm->count > 2) ++el->count_more_two;

el->common += pm->heaver;

pm = pm->next;

}

mddl = el->common/ind;

while(man)

{

if (man->index == ch)

{

strcpy(el->surname,man->surname);

el->middle = (float)man->heaver/man->count;

break;

}

man = man->next;

}

clrscr();

for_PA *pel;

pel = new for_PA;

pel->surname = new char [15];

if ((mddl - el->middle) < fabs(0.3))

{

fprintf(to,"%d %d %s - %f\n",el->common, el->count_more_two, el->surname, el->middle);

printf("%d %d %s - %f\n",el->common, el->count_more_two, el->surname, el->middle);

printf("%f",mddl);

}

else

{

fprintf(to,"%d %d\n",el->common, el->count_more_two);

printf("%d %d %s - %f\n",el->common, el->count_more_two, el->surname, el->middle);

printf("%f",mddl);

}

fclose(to);

getch();

}

//-----------------------------output function_________________________

void output(void)

{

clrscr();

luggage *man;

man = new luggage;

man->surname = new char[15];

man = form();

printf("\n\n\n\n\t----------------------------------------------------------------\n");

printf("\t| number | surname | count of luggage | heaver of luggage |\n");

printf("\t----------------------------------------------------------------\n");

while (man)

{

printf("\t| %3d | %12s | %8d | %10d |\n",man->index, man->surname, man->count, man->heaver);

man = man->next;

}

printf("\t----------------------------------------------------------------\n");

getch();

}

//__________________________________revival function_________

void revival(void){

luggage *one;

one = new luggage;

one->surname = new char [15];

one = form(1);

int ind = 1;

FILE *to;

if ((to = fopen("P.dat","w")) == NULL) {

printf("Error of opening file with data\n");

getch();

exit(1); }

fseek(to,0,0);

while(one) {

fprintf(to,"%d %s %d %d %d\n",ind,one->surname,one->count,one->heaver,0);

ind++;

one = one->next; }

fclose(to);}

ДОДАТОК B

Блок-схема функції main()

ТАК

НІ

ТАК

НІ

ТАК

НІ

ТАК

НІ

ТАК

ТАК НІ

Блок-схема функції get_index()

Блок-схема функції complete()

 

Блок-схема функції deleting ()

Блок-схема функції revival()

Блок-схема функції analysis()

Блок-схема функції output()

Блок-схема функції form();


Сторінки: 1 2