C语言程序编写填空!

发布网友 发布时间:2022-04-24 04:44

我来回答

2个回答

热心网友 时间:2023-10-29 08:25

void main()
{ int n,fahr,hot,comfort,cold;
double total,ave ;
FILE *fp;
if((fp=___fopen____ ("data.txt","r"))==NULL) //以读方式打开数据文件
{ printf("can not open file!");
exit(0);
}
hot=comfort=cold=0;
total=0; n=0;
while(!feof(fp)) //当文件未读完时
{ //从文件中读入华氏温度 fahr
___fscanf____ (fp,"%d",&fahr);
total=___total____+fahr;
n++;
if(fahr>=90)
hot++;
else if (fahr>=50)
comfort++ ;
else
cold++;
}
ave= total/n ;
printf("hot=%d, comfort =%d,cold =%d, average =%f",hot,comfort,cold,ave);
fclose(___fp____);
}

热心网友 时间:2023-10-29 08:25

#include<stdio.h>int fun( int x,int y){int i;int z=1; for(i=1;i<=y;i++) z=z*x;return z;}int main(){printf("%d\n",fun(3,2));return 0;}
求采纳为满意回答。

热心网友 时间:2023-10-29 08:25

void main()
{ int n,fahr,hot,comfort,cold;
double total,ave ;
FILE *fp;
if((fp=___fopen____ ("data.txt","r"))==NULL) //以读方式打开数据文件
{ printf("can not open file!");
exit(0);
}
hot=comfort=cold=0;
total=0; n=0;
while(!feof(fp)) //当文件未读完时
{ //从文件中读入华氏温度 fahr
___fscanf____ (fp,"%d",&fahr);
total=___total____+fahr;
n++;
if(fahr>=90)
hot++;
else if (fahr>=50)
comfort++ ;
else
cold++;
}
ave= total/n ;
printf("hot=%d, comfort =%d,cold =%d, average =%f",hot,comfort,cold,ave);
fclose(___fp____);
}

热心网友 时间:2023-10-29 08:25

#include<stdio.h>int fun( int x,int y){int i;int z=1; for(i=1;i<=y;i++) z=z*x;return z;}int main(){printf("%d\n",fun(3,2));return 0;}
求采纳为满意回答。

热心网友 时间:2023-10-29 08:25

void main()
{ int n,fahr,hot,comfort,cold;
double total,ave ;
FILE *fp;
if((fp=___fopen____ ("data.txt","r"))==NULL) //以读方式打开数据文件
{ printf("can not open file!");
exit(0);
}
hot=comfort=cold=0;
total=0; n=0;
while(!feof(fp)) //当文件未读完时
{ //从文件中读入华氏温度 fahr
___fscanf____ (fp,"%d",&fahr);
total=___total____+fahr;
n++;
if(fahr>=90)
hot++;
else if (fahr>=50)
comfort++ ;
else
cold++;
}
ave= total/n ;
printf("hot=%d, comfort =%d,cold =%d, average =%f",hot,comfort,cold,ave);
fclose(___fp____);
}

热心网友 时间:2023-10-29 08:26

#include<stdio.h>int fun( int x,int y){int i;int z=1; for(i=1;i<=y;i++) z=z*x;return z;}int main(){printf("%d\n",fun(3,2));return 0;}
求采纳为满意回答。

热心网友 时间:2023-10-29 08:25

void main()
{ int n,fahr,hot,comfort,cold;
double total,ave ;
FILE *fp;
if((fp=___fopen____ ("data.txt","r"))==NULL) //以读方式打开数据文件
{ printf("can not open file!");
exit(0);
}
hot=comfort=cold=0;
total=0; n=0;
while(!feof(fp)) //当文件未读完时
{ //从文件中读入华氏温度 fahr
___fscanf____ (fp,"%d",&fahr);
total=___total____+fahr;
n++;
if(fahr>=90)
hot++;
else if (fahr>=50)
comfort++ ;
else
cold++;
}
ave= total/n ;
printf("hot=%d, comfort =%d,cold =%d, average =%f",hot,comfort,cold,ave);
fclose(___fp____);
}

热心网友 时间:2023-10-29 08:26

#include<stdio.h>int fun( int x,int y){int i;int z=1; for(i=1;i<=y;i++) z=z*x;return z;}int main(){printf("%d\n",fun(3,2));return 0;}
求采纳为满意回答。

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com