• 2021-04-14
    阅读以下程序,对程序功能的描述中正确的是
    #icnlude
    int main()
    {
    FILE *in, *out;
    char ch, infile[10], outfile[10];
    printf("Enter the infile name:");
    scanf("%s", infile);
    printf("Enter the outfile name:");
    scanf("%s", outfile);
    if ((in = fopen(infile, "r")) == NULL)
    {
    printf("cannot open infile.");
    exit(0);
    }
    if ((out = fopen(outfile, "w")) == NULL)
    {
    printf("cannot open outfile.");
    exit(0);
    }
    while (!feof(in))
    {
    fputc(fgetc(in), out);
    }
    fclose(in);
    fclose(out);
    return 0;
    }
  • 举一反三