Problem with result 0 in c4droid

CSDN Q & A 2021-12-30 04:18:32 阅读数:825

problem result c4droid droid

The code is as follows :
#include<stdio.h>
float l, lw, dw, b;
float w, d, D;
int i=1;
int main(){
while (i>0){
printf("\n======================================================");
sleep(1);
printf("\n Welcome to the ship information quick design module \n");
printf(" Input order :\t Waterline length :");
scanf("%f", &l);
printf("\n\t\t Waterline aspect ratio :");
scanf("%f", &lw);
printf("\n\t\t Draft to waterline width ratio :");
scanf("%f", &dw);
printf("\n\t\t Square coefficient :");
scanf("%f", &b);
w = 1.0 / lw * l;
d = w * dw;
D = l * w * d * b;
printf("\n\n The information about the hull is as follows :");
printf("\n Waterline length :\t\t%f", &l);
printf("\n Waterline width :\t\t%f", &w);
printf("\n Draft :\t\t%f", &d);
printf("\n\n Aspect ratio :\t\t%f", &lw);
printf("\n Draft to waterline width ratio :\t%f", &dw);
printf("\n\n displacement :\t\t%f", &D);
printf("\n======================================================");
printf("\n\n Enter any number for the next operation ");
scanf("%d", &i);
i = 1;
}
}

The operation diagram is as follows

img




Refer to the answer 1:

When outputting , Don't add address symbols &




Refer to the answer 2:



Refer to the answer 3:

printf("\n Waterline length :\t\t%f", &l);
Change it to
printf("\n Waterline length :\t\t%f", l);
The later ones are the same ,printf Floating point output does not need to add &




Refer to the answer 4:
版权声明:本文为[CSDN Q & A]所创,转载请带上原文链接,感谢。 https://primo.wiki/2021/12/202112300418297784.html