Автор работы: Пользователь скрыл имя, 04 Октября 2009 в 08:57, Не определен
описание применения
fscanf(f_dat,"%d",&IG.cena);
fseek(f_dat,1,SEEK_CUR);
fgets(IG.socket,10,f_dat);
fseek(f_dat,1,SEEK_CUR);
if(strcmp(IG.marka,min)==0)
{
fprintf(f_tmp,"%s %s %s %d %d %s
",IG.proizv,IG.tip,IG.marka,
}
}while(ftell(f_dat)!=k);
fseek(f_dat,0,SEEK_SET);
strcpy(sort,max);
do
{
fgets(IG.proizv,20,f_dat);
fseek(f_dat,1,SEEK_CUR);
fgets(IG.tip,20,f_dat);
fseek(f_dat,1,SEEK_CUR);
fgets(IG.marka,20,f_dat);
fseek(f_dat,1,SEEK_CUR);
fscanf(f_dat,"%d",&IG.hz);
fseek(f_dat,1,SEEK_CUR);
fscanf(f_dat,"%d",&IG.cena);
fseek(f_dat,1,SEEK_CUR);
fgets(IG.socket,10,f_dat);
fseek(f_dat,1,SEEK_CUR);
if(strcmp(IG.marka,min)>0 && strcmp(IG.marka,sort)<0) strcpy(sort,IG.marka);
}while(ftell(f_dat)!=k);
strcpy(min,sort);
}while(strcmp(max,sort)!
if(strcmp(max,rmin)!=0)
{
fseek(f_dat,0,SEEK_SET);
do
{
fgets(IG.proizv,
fseek(f_dat,1,
fgets(IG.tip,20,f_
fseek(f_dat,1,
fgets(IG.marka,20,
fseek(f_dat,1,
fscanf(f_dat,"%d",
fseek(f_dat,1,
fscanf(f_dat,"%d",
fseek(f_dat,1,
fgets(IG.socket,
fseek(f_dat,1,
if(strcmp(max,IG.
{
fprintf(f_tmp,"%s
%s %s %d %d %s ",IG.proizv,IG.tip,IG.marka,
break;
}
}while(ftell(f_dat)!=k);
}
fclose(f_dat);
fclose(f_tmp);
}
}
search(m,n)
{
char s1[50]={""},search[50]={""};
long k;
struct IG{
char proizv[20];
char tip[20];
char marka[20];
int hz;
int cena;
char socket[10];
} IG,SIG;
FILE *f_tmp,*f_srch;
f_tmp=fopen("temp.dat","rt");
f_srch=fopen("search.dat","wt"
gotoxy(26,14);
fgets(s1,44,stdin);
strncpy(search,s1,strlen(s1)-
fseek(f_tmp,0,SEEK_END);
k=ftell(f_tmp);
fseek(f_tmp,0,SEEK_SET);
do
{
fgets(IG.proizv,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.tip,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.marka,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fscanf(f_tmp,"%d",&IG.hz);
fseek(f_tmp,1,SEEK_CUR);
fscanf(f_tmp,"%d",&IG.cena);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.socket,10,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
strcpy(SIG.proizv,IG.proizv);
strcpy(SIG.tip,IG.tip);
strcpy(SIG.marka,IG.marka);
strcpy(SIG.socket,IG.socket);
strlwr(SIG.proizv);
strlwr(SIG.tip);
strlwr(SIG.marka);
strlwr(SIG.socket);
strlwr(search);
if(m==2&&n==0)
{
if(strstr(IG.tip,search)!=
fprintf(f_srch,"%s %s %s %d %d %s ",IG.proizv,IG.tip,IG.marka,
}
if(m==2&&n==1)
{
if(strstr(IG.socket,search)!=
fprintf(f_srch,"%s %s %s %d %d %s ",IG.proizv,IG.tip,IG.marka,
}
if(m==3&&n==0)
{
if(strstr(IG.proizv,search)!=
fprintf(f_srch,"%s %s %s %d %d %s ",IG.proizv,IG.tip,IG.marka,
}
if(m==3&&n==1)
{
if(strstr(IG.marka,search)!=
fprintf(f_srch,"%s %s %s %d %d %s ",IG.proizv,IG.tip,IG.marka,
}
}while(ftell(f_tmp)!=k);
fclose(f_tmp);
fclose(f_srch);
}
set_of(n,nscr,fil,d)
{
int i;
draw_window(1,80,6,24,1);
textbackground(RED);
gotoxy(2,2*n+7);
for(i=2;i<=79;i++) {cprintf(" ");}
textbackground(1);
draw_table_col(15,6,24);
draw_table_col(25,6,24);
draw_table_col(35,6,24);
draw_table_col(45,6,24);
draw_table_col(52,6,24);
nscr=print_to_screen(nscr,fil,
return(nscr);
}
delete(nscr,s)
{
int i,l=0,n,fil=0,rikey,key,ikey,
long k;
struct IG{
char proizv[20];
char tip[20];
char marka[20];
int hz;
int cena;
char socket[10];
} IG;
FILE *f_dat,*f_tmp;
nscr=0;
d=1;
n=0;
B:
l=0;
nscr=set_of(n,nscr,fil,d);
do
{
if((key=getch())==0) key=getch();
switch(key)
{
case 27: break;
case 73: nscr--; if(nscr<0) nscr=0; leaf=0; n=0; nscr=set_of(n,nscr,fil,d); break;
case 81: nscr++; n=0; leaf++; nscr=set_of(n,nscr,fil,d); break;
case 80: n++; if(n>7) n=0; nscr=set_of(n,nscr,fil,d); break;
case 72: if(n>0) n--; else n=7; nscr=set_of(n,nscr,fil,d); break;
case 83: f_dat=fopen("data.dat","wt");
f_tmp=fopen("temp.
fseek(f_tmp,0,
k=ftell(f_tmp);
fseek(f_tmp,0,SEEK_SET);
do
{
fgets(IG.proizv,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.tip,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.marka,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fscanf(f_tmp,"%d",&IG.hz);
fseek(f_tmp,1,SEEK_CUR);
fscanf(f_tmp,"%d",&IG.cena);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.socket,10,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
l++;
if(l!=(leaf*8+n+1))
{
fprintf(f_
}
}while(ftell(f_
fclose(f_dat);
fclose(f_tmp);
switch(s)
{
case 0: sort_info_1(); break;
case 1: sort_info_1(); break;
case 2: sort_info(4,2); break;
case 3: sort_info(4,3); break;
}
nscr=set_of(n,
goto B;
}
}while(key!=27);
d=0;
}
edit(nscr,s)
{
int b,i,l=0,n,fil=0,rikey,key,
long k;
struct IG{
char proizv[20];
char tip[20];
char marka[20];
int hz;
int cena;
char socket[10];
} IG;
FILE *f_dat,*f_tmp;
nscr=0;
d=1;
n=0;
l=0;
set_of(n,nscr,fil,d);
do
{
if((key=getch())==0) key=getch();
switch(key)
{
case 27: break;
case 73: nscr--; if(nscr<0) nscr=0; leaf=0; n=0; nscr=set_of(n,nscr,fil,d); break;
case 81: nscr++; n=0; leaf++; nscr=set_of(n,nscr,fil,d); break;
case 80: n++; if(n>7) n=0; nscr=set_of(n,nscr,fil,d); break;
case 72: if(n>0) n--; else n=7; nscr=set_of(n,nscr,fil,d); break;
case 13: f_dat=fopen("data.dat","wt");
f_tmp=fopen("temp.
fseek(f_tmp,0,
k=ftell(f_tmp);
fseek(f_tmp,0,SEEK_SET);
do
{
fgets(IG.proizv,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.tip,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.marka,20,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
fscanf(f_tmp,"%d",&IG.hz);
fseek(f_tmp,1,SEEK_CUR);
fscanf(f_tmp,"%d",&IG.cena);
fseek(f_tmp,1,SEEK_CUR);
fgets(IG.socket,10,f_tmp);
fseek(f_tmp,1,SEEK_CUR);
l++;
if(l!=(leaf*8+n+1))
{
fprintf(f_dat,"%s %s
%s %d %d %s ",IG.proizv,IG.tip,IG.marka,
}
else {
fclose(f_
f_dat=fopen(
window_add_
textbackgrou
gotoxy(30,7)
cprintf("
add();
b=button(25,
if(b==0) copy_add();
else fprintf(f_dat,"%s %s %s %d %d
%s ",IG.proizv,IG.tip,IG.marka,
}
}while(ftell(f_
fclose(f_dat);
fclose(f_tmp);
switch(s)
{
Информация о работе Информационно поисковая система «Процессоры»