鱼C论坛

 找回密码
 立即注册
查看: 2195|回复: 0

在线急等大家帮我看下,我的程序怪怪的,可以运行但没结果

[复制链接]
发表于 2012-1-13 07:20:27 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
写一个程序写入一排整数(0除外)到一个文本文件。
接下来,编写一个程序文件,决定在这些数字的最大值和最小值。
那么这个程序必须写在这个文件中的所有数字,小于最大平均
值和最小平均值,到一个新的文本文件。所有的数字都写后,新文件的内容必须
打印到屏幕上。




/* Includes */
#include <stdio.h>

/*        Main program */
int main(void)
{

        /* Function Declarations */
        void fill(FILE *);

        /* Variables */
        FILE *flp;
        char name[20]="Q:\\in.txt";

        {
                clrscr();
                printf("the number must enter in row,and with space between each other\n");
                flp=fopen(name,"w");

                fill(flp);
                fclose(flp);
        }
        return(0);
}
/* Function Definitions */

void fill(FILE *flp)
{
        int getal;

        printf("\ngive a list of numbers(stop=0): \n");
        printf("\t");
        scanf("%d",&getal);
        while(getal!=0)
        {
                printf("\t");
                fprintf(flp,"%d ",getal);
                scanf("%d",&getal);

        }
   fprintf(flp,"%d",getal);

}
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-10 18:36

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表