输出全是0.00不知道为什么
问题描述:
(g1oba1s)
查看类 实验3.1.cpp
C:Users\xwp\实验3.1.exe
兰 #include<stdio.h
2 floatdu(floatc,intf) 82 45
3E 32 0.00
C=5.0*(f-32.0)/9.0 4 83 0.00
5 return c 0.00
44 0.00
intmain()
8F
9 intn,mf
8x1 ted after3.24seconds with return value 0
10 floatc;
scanf(“%d%d”8n,8m); 11
12 if(n>e&8n<m88m<1000)
13153113122
for(f=n;f<=mf=f+4)
du(c,f)
printf(“%d%10.2f\n”,f,C)
return e
答
你这里的C没有初始化,C++的debug版会默认帮你初始化成0
du函数float du(float c, int f)
传入的两个参数都是传值参数,里面对C的修改不会对外面的产生影响
外面也没有其它地方对C赋值
所以c就一直是0了
答
c = du(c,f)