展开全部
/*头文件*/
#include "stdio.h"
#include "conio.h"
int menu()
{
int a;
printf("\t\t******************************MENU****************************\n");
printf("\t\t* 1.showtext *\n");
printf("\t\t* 2.tongji * \n");
printf("\t\t* 3.exit *\n");
printf("\t\t**************************************************************\n");
return(a);
}
char abc[100];
int load_textFile()
{
FILE *fp;
int i;
if((fp=fopen("abc.txt","r"))==NULL)
{
printf("Cannot open file strike any key exit!");
return 0;
}
for(i=0;!feof(fp);i++)
fscanf(fp,"%s",abc[i]);
fclose(fp);
return(i);
}
void print()
{
int i;
for(i=0;i<100;i++)
{
printf("%s",abc[i]);
}
getch();
}
void readfiles()
{
int n;
n=load_textFile();
printf(n); /**/
}
int save_spt()
{
FILE *fp;
int i;
if((fp=fopen("abc.txt","w"))==NULL) /**/
{
printf("Cannot open file strike any key exit!");
return NULL;
}
for(i=0;i<100;i++)
fprintf(fp,"%s",abc[i]);
fclose(fp);
return 1;
}
showtext()
{
readfiles();}
tongji()
{
int i,zimu=0,qita=0;
for(i=0;i<100;i++)
if(abc[i]>=65&&abc[i]<=117)
zimu++;
else
qita++;
printf("%d\n",zimu);
printf("%d",qita);
}
/*主函数*/
main()
{
int a;
a=menu(); /*调用主菜单*/
if(a>3||a<1)
while(1)
{
printf("\n please Enter your choice(1-3):[ ]\b\b");
scanf("%d",&a);
switch(a)
{
case 1:showtext();break; /*一级主调函数*/
case 2:tongji();break;
case 3:exit(0);
}
}
}
text文件: a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
#include "stdio.h"
#include "conio.h"
int menu()
{
int a;
printf("\t\t******************************MENU****************************\n");
printf("\t\t* 1.showtext *\n");
printf("\t\t* 2.tongji * \n");
printf("\t\t* 3.exit *\n");
printf("\t\t**************************************************************\n");
return(a);
}
char abc[100];
int load_textFile()
{
FILE *fp;
int i;
if((fp=fopen("abc.txt","r"))==NULL)
{
printf("Cannot open file strike any key exit!");
return 0;
}
for(i=0;!feof(fp);i++)
fscanf(fp,"%s",abc[i]);
fclose(fp);
return(i);
}
void print()
{
int i;
for(i=0;i<100;i++)
{
printf("%s",abc[i]);
}
getch();
}
void readfiles()
{
int n;
n=load_textFile();
printf(n); /**/
}
int save_spt()
{
FILE *fp;
int i;
if((fp=fopen("abc.txt","w"))==NULL) /**/
{
printf("Cannot open file strike any key exit!");
return NULL;
}
for(i=0;i<100;i++)
fprintf(fp,"%s",abc[i]);
fclose(fp);
return 1;
}
showtext()
{
readfiles();}
tongji()
{
int i,zimu=0,qita=0;
for(i=0;i<100;i++)
if(abc[i]>=65&&abc[i]<=117)
zimu++;
else
qita++;
printf("%d\n",zimu);
printf("%d",qita);
}
/*主函数*/
main()
{
int a;
a=menu(); /*调用主菜单*/
if(a>3||a<1)
while(1)
{
printf("\n please Enter your choice(1-3):[ ]\b\b");
scanf("%d",&a);
switch(a)
{
case 1:showtext();break; /*一级主调函数*/
case 2:tongji();break;
case 3:exit(0);
}
}
}
text文件: a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询