#include <stdio.h>
#include <stdlib.h>

main()
{
    FILE *fp;
    int num=0,i;
    char c,str1[100];

    printf("input string endwith enter:\n");
    gets(str1);
    
    fp=fopen("lhsbqb.txt","w");
    if(fp==NULL){printf("File open faild!");exit(0);}
    for(i=0;str1[i]!='\0';i++)
    {
        fputc(str1[i],fp);
    }
    fclose(fp);

    fp=fopen("lhsbqb.txt","r");
    if(fp==NULL){printf("File open faild!");exit(0);}
    while(1)
    {
        c=fgetc(fp);
        if(c==EOF)break;
        if(c>='A' && c<='Z')
        {
            num++;
        }
    }
    fclose(fp);
    printf("文件里有大字字母%d个",num);
    getchar();

}

http://www.pythonschool.com/python/13.html 转摘

相关文章:

  • 2022-01-20
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-18
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
相关资源
相似解决方案