gpt4 book ai didi

c - 基本的 C 格式问题

转载 作者:太空宇宙 更新时间:2023-11-04 01:31:04 24 4
gpt4 key购买 nike

对于这个作业,我希望我的程序输出请求的输出。我的问题在于格式。
链接到相关问题: http://i1306.photobucket.com/albums/s576/sammyr2011/eng32111_zps3a5d52fd.png

程序的输出: http://i1306.photobucket.com/albums/s576/sammyr2011/outputofquestion1_zps2aa9558a.png

无论出于何种原因,我的 x 值都没有增加十倍,就间距而言,我不确定我做错了什么。

#include <stdio.h>

//declare global variables
int x = 1;
double num = .1234;

//prototype functions
partA(double num);

int main() {
double a;
a = partA(num);
printf("%lf\n",a);
}

/*First Function, x and num increase by a factor
of ten. */
partA(double num) {
for(x; x <= 10000; x *= 10) {
for (num; num <= 1234; num *= 10) {
printf("%d%4lf\n",x, num);
}
printf("\n");
}
}

最佳答案

间距是因为只有包含 printf 的外层循环在执行

关于c - 基本的 C 格式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22310030/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com