zoukankan      html  css  js  c++  java
  • c语言 13-8 、13

    13-8、

    #include <stdio.h>
    
    int main(void)
    {
        FILE *sfp;
        FILE *dfp;
        int ch;
        char sfilename[FILENAME_MAX];
        char dfilename[FILENAME_MAX];
        printf("Please input the sfilename: "); scanf("%s", sfilename);
        printf("Please input the dfilename: "); scanf("%s", dfilename);
        
        if((sfp = fopen(sfilename, "r")) == NULL)
            printf("aSource file open failed.
    ");
        else
        {
            if((dfp = fopen(dfilename, "w")) == NULL)
                printf("aDestination file open failed.
    ");
            else
            {
                while((ch = fgetc(sfp)) != EOF)
                {
                    putchar(ch);
                    fputc(ch, dfp);
                }
                fclose(dfp);
            }
            fclose(sfp);
        } 
        return 0;
    }

    13 - 9、

    #include <stdio.h>
    #include <ctype.h>
    
    int main(void)
    {
        FILE *sfp;
        FILE *dfp;
        int ch;
        char sfilename[FILENAME_MAX];
        char dfilename[FILENAME_MAX];
        printf("Please input the sfilename: "); scanf("%s", sfilename);
        printf("Please input the dfilename: "); scanf("%s", dfilename);
        
        if((sfp = fopen(sfilename, "r")) == NULL)
            printf("aSource file open failed.
    ");
        else
        {
            if((dfp = fopen(dfilename, "w")) == NULL)
                printf("aDestination file open failed.
    ");
            else
            {
                while((ch = fgetc(sfp)) != EOF)
                    fputc(toupper(ch), dfp);
                fclose(dfp);
            }
            fclose(sfp);
        }
        return 0;
    }

    13-10、

    #include <stdio.h>
    #include <ctype.h>
    
    int main(void)
    {
        FILE *sfp;
        FILE *dfp;
        int ch;
        char sfilename[FILENAME_MAX];
        char dfilename[FILENAME_MAX];
        printf("Please input the sfilename: "); scanf("%s", sfilename);
        printf("Please input the dfilename: "); scanf("%s", dfilename);
        
        if((sfp = fopen(sfilename, "r")) == NULL)
            printf("aSfilename open failed.
    ");
        else
        {
            if((dfp = fopen(dfilename, "w")) == NULL)
                printf("aDfilename open failed.
    ");
            else
            {
                while((ch = fgetc(sfp)) != EOF)
                    fputc(tolower(ch), dfp);
                fclose(dfp);
            }
            fclose(sfp);
        }
        return 0;
    }
  • 相关阅读:
    sql count中加条件
    zero-copy总结
    问题诊断神器arthas
    rabbitmq 消息确认
    HttpRunner安装笔记(1)安装环境准备:pyenv安装
    centos7 安装rabbitmq3.4.1-1
    centos7 python2.7.5 升级python3.6.4
    测试面试必会sql(1)
    mysql5.6 无法远程连接问题解决
    Katalon 学习笔记(一)
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14874185.html
Copyright © 2011-2022 走看看