主题:帮帮忙,给看看!
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
void main()
{
time_t t;
time(&t);
FILE *p1,*p2;
char a[10],d[10];
int b,sc=1;//s->Sreaching
int sj=0;
int sline=1,number=0;
char word[10];
char scell[10];
char k='y';
int hj=1,hi=0;//h->huoye
int hline=0;
int ha;
char hk='y';
char hcell[2000];
/************************Starting****************************************/
printf("\n");
printf(" ************ Huappy Using ! *******\n");
printf(" ************Welcome To The System Of Searching.***********\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n\n");
printf("\n\n 1.Starting ");
printf("\n\n 2.Exit() ");
printf("\n\n 3.Enter your wantting:\n");
scanf("%d",&b);
while(b==2)
exit(0);
system("cls");
/**********************Opening Files*************************************/
printf("\n\n\n");
printf(" ************ Huappy Using ! *******\n");
printf(" ************Welcome To The System Of Searching.******\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n\n\n");
printf(" 1.Enter your want to open file:");
printf("\n\n 2.Exit() ");
printf("\n\n 3.Enter your wantting:\n");
scanf("%d",&b);getchar();
while(b==2)
exit(0);
system("cls");
/*************************************Opening Files**********************/
printf("\n\n\n\n\n");
printf(" ************ Huappy Using ! ******\n");
printf(" ************Welcome To The System Of Searching.*******n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n\n\n\n");
printf(" 1.Enter your want to open file:");
scanf("%s",a);
strcpy(d,a);
system("cls");
/*************************************Xianshi*********************************/
printf(" ************ File ******\n")
if((p1=fopen(a,"r+"))==NULL)//活区显示:出错了
{
printf("cannot open file\n");
}
hcell[hj]=fgetc(p1);
while(hcell[hj]!=EOF)
{
if(hk=='y')
{
while(hi<20)
{
hline++;
printf("line:%d",hline);
while(hcell[hj]!=10)
{
printf("%c",hcell[hj]);
hj++;
hcell[hj]=fgetc(p1);
if(hcell[hj]==EOF)
hcell[hj]='\0';
}
printf("\n");
hi++;
hcell[hj]=fgetc(p1);
if(hi==20)
{
printf("\n\n");
printf(" 1.Contine\n");
printf(" 2.Ending\n");
printf(" 3.Exit\n");
printf(" 4.Entering:");
scanf("%d",&ha);
if(ha==1)
{
hk='y';
hi=0;
system("cls");
}
while(ha==3)
exit(0);
}
//printf(" 1.Contine\n");//
// printf(" 2.Exit\n");
// printf(" 3.Entering:");
// scanf("%d",&b);
// while(b==2)
// exit(0);
}
}
}
fclose(p1);
system("cls");
/*************************Entering***************************************/
if((p2=fopen(d,"a+"))==NULL)
{
printf("cannot open file\n");
}
while(k=='y')
{
printf("\n\n");
printf(" ************ Huappy Using ! ***********\n");
printf(" ************Welcome To The System Of Searching.***********\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n");
printf(" 1.Enter wanting word ");
printf("\n\n");
printf(" 2.Exit() ");
printf("\n\n");
printf(" 3.Enter your wantting:\n");
scanf("%d",&b);
while(b==2)
exit(0);
system("cls");
/*************************************Entering************************************************/
printf("\n\n");
printf(" ************ Huappy Using ! ***********\n");
printf(" ************Welcome To The System Of Searching.***********\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n");
printf(" 1.Enter wanting word ");
scanf("%s",&word);
system("cls");
/*****************************searching***********************/
printf(" ************ Huappy Using !*****\n");
printf(" ************ searching ***\n");
printf(" Nowing Time:%s",ctime(&t) );
scell[sj]=fgetc(p2);
while(scell[sj]!=EOF)
{
while(scell[sj]!=10)
{
while(scell[sj]!=' ')
{
sj++;
scell[sj]=fgetc(p2);
}
scell[sj]='\0';
if(strcmp(word,scell)==0)
{
number++;
if(sc==sline)
{
sc++;
printf(" line:%d\n",sline);
}
printf("number:%d\n",number);
}
sj=0;
scell[sj]=fgetc(p2);
}
sline++;
sc=sline;
scell[sj]=fgetc(p2);
}
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
scanf("%d",&b);
while(b==2)
exit(0);
system("cls");
/*************************************Adding *************/
printf(" ************ Huappy Using ! \n");
printf(" ************ Adding \n");
printf(" Nowing Time:%s",ctime(&t) );
//在制定行中插入文本 格式i<行数><回车><文本><回车>
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
scanf("%d",&b);
system("cls");
/********************** Deleting*********************/
printf(" ************ Huappy Using ! \n");
printf(" ******* Deleting \n");
printf(" Nowing Time:%s",ctime(&t) );
//行删除格式d<行号>[t<行号>]<回车>
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
scanf("%d",&b);
system("cls");
fclose(p2);
/**********************Printing******************************/
printf("\n\n\n");
printf(" ******** Huappy Using ! \n");
printf(" *****Welcome To The System Of Searching.*\n");
printf(" Nowing Time:%s",ctime(&t) );
system("cls");
/***********************Ending*******************/
printf("\n\n");
printf(" *Welcome To The System Of Searching.*\n");
printf(" *** Thinking Using ! **\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
printf("\n\n");
printf(" 3.Enter your wantting:\n");
scanf("%d",&b);
while(b==2)
exit(0);
while(b==1)
k='y';
system("cls");
}
system("cls");
}
帮忙看看啊。
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
void main()
{
time_t t;
time(&t);
FILE *p1,*p2;
char a[10],d[10];
int b,sc=1;//s->Sreaching
int sj=0;
int sline=1,number=0;
char word[10];
char scell[10];
char k='y';
int hj=1,hi=0;//h->huoye
int hline=0;
int ha;
char hk='y';
char hcell[2000];
/************************Starting****************************************/
printf("\n");
printf(" ************ Huappy Using ! *******\n");
printf(" ************Welcome To The System Of Searching.***********\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n\n");
printf("\n\n 1.Starting ");
printf("\n\n 2.Exit() ");
printf("\n\n 3.Enter your wantting:\n");
scanf("%d",&b);
while(b==2)
exit(0);
system("cls");
/**********************Opening Files*************************************/
printf("\n\n\n");
printf(" ************ Huappy Using ! *******\n");
printf(" ************Welcome To The System Of Searching.******\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n\n\n");
printf(" 1.Enter your want to open file:");
printf("\n\n 2.Exit() ");
printf("\n\n 3.Enter your wantting:\n");
scanf("%d",&b);getchar();
while(b==2)
exit(0);
system("cls");
/*************************************Opening Files**********************/
printf("\n\n\n\n\n");
printf(" ************ Huappy Using ! ******\n");
printf(" ************Welcome To The System Of Searching.*******n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n\n\n\n");
printf(" 1.Enter your want to open file:");
scanf("%s",a);
strcpy(d,a);
system("cls");
/*************************************Xianshi*********************************/
printf(" ************ File ******\n")
if((p1=fopen(a,"r+"))==NULL)//活区显示:出错了
{
printf("cannot open file\n");
}
hcell[hj]=fgetc(p1);
while(hcell[hj]!=EOF)
{
if(hk=='y')
{
while(hi<20)
{
hline++;
printf("line:%d",hline);
while(hcell[hj]!=10)
{
printf("%c",hcell[hj]);
hj++;
hcell[hj]=fgetc(p1);
if(hcell[hj]==EOF)
hcell[hj]='\0';
}
printf("\n");
hi++;
hcell[hj]=fgetc(p1);
if(hi==20)
{
printf("\n\n");
printf(" 1.Contine\n");
printf(" 2.Ending\n");
printf(" 3.Exit\n");
printf(" 4.Entering:");
scanf("%d",&ha);
if(ha==1)
{
hk='y';
hi=0;
system("cls");
}
while(ha==3)
exit(0);
}
//printf(" 1.Contine\n");//
// printf(" 2.Exit\n");
// printf(" 3.Entering:");
// scanf("%d",&b);
// while(b==2)
// exit(0);
}
}
}
fclose(p1);
system("cls");
/*************************Entering***************************************/
if((p2=fopen(d,"a+"))==NULL)
{
printf("cannot open file\n");
}
while(k=='y')
{
printf("\n\n");
printf(" ************ Huappy Using ! ***********\n");
printf(" ************Welcome To The System Of Searching.***********\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n");
printf(" 1.Enter wanting word ");
printf("\n\n");
printf(" 2.Exit() ");
printf("\n\n");
printf(" 3.Enter your wantting:\n");
scanf("%d",&b);
while(b==2)
exit(0);
system("cls");
/*************************************Entering************************************************/
printf("\n\n");
printf(" ************ Huappy Using ! ***********\n");
printf(" ************Welcome To The System Of Searching.***********\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n");
printf(" 1.Enter wanting word ");
scanf("%s",&word);
system("cls");
/*****************************searching***********************/
printf(" ************ Huappy Using !*****\n");
printf(" ************ searching ***\n");
printf(" Nowing Time:%s",ctime(&t) );
scell[sj]=fgetc(p2);
while(scell[sj]!=EOF)
{
while(scell[sj]!=10)
{
while(scell[sj]!=' ')
{
sj++;
scell[sj]=fgetc(p2);
}
scell[sj]='\0';
if(strcmp(word,scell)==0)
{
number++;
if(sc==sline)
{
sc++;
printf(" line:%d\n",sline);
}
printf("number:%d\n",number);
}
sj=0;
scell[sj]=fgetc(p2);
}
sline++;
sc=sline;
scell[sj]=fgetc(p2);
}
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
scanf("%d",&b);
while(b==2)
exit(0);
system("cls");
/*************************************Adding *************/
printf(" ************ Huappy Using ! \n");
printf(" ************ Adding \n");
printf(" Nowing Time:%s",ctime(&t) );
//在制定行中插入文本 格式i<行数><回车><文本><回车>
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
scanf("%d",&b);
system("cls");
/********************** Deleting*********************/
printf(" ************ Huappy Using ! \n");
printf(" ******* Deleting \n");
printf(" Nowing Time:%s",ctime(&t) );
//行删除格式d<行号>[t<行号>]<回车>
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
scanf("%d",&b);
system("cls");
fclose(p2);
/**********************Printing******************************/
printf("\n\n\n");
printf(" ******** Huappy Using ! \n");
printf(" *****Welcome To The System Of Searching.*\n");
printf(" Nowing Time:%s",ctime(&t) );
system("cls");
/***********************Ending*******************/
printf("\n\n");
printf(" *Welcome To The System Of Searching.*\n");
printf(" *** Thinking Using ! **\n");
printf(" Nowing Time:%s",ctime(&t) );
printf("\n\n");
printf(" 1.Contine ");
printf("\n\n");
printf(" 2.Exit() ");
printf("\n\n");
printf(" 3.Enter your wantting:\n");
scanf("%d",&b);
while(b==2)
exit(0);
while(b==1)
k='y';
system("cls");
}
system("cls");
}
帮忙看看啊。