这神马情况!
程序代码:void show(double number[], int count, unsigned int j)
{
char str[12] = "%"; //格式化字符宽度值
int i = 1;
printf("count == %d\nstr == %s\n",count,str);
do
{
str[i++] = '0'+count%10;
}while(count/= 10 >0);
str[i] = '\0';
strcat(str,"lf");
printf("%s\n",str);
for(i=0;i<j;i++)
{
if(i%5==0)
printf("\n");
printf(str,number[i]);
}
}count在printf()输出的时候还是12,可在do{}while中竟然成了乱码
程序代码:#include <stdio.h>
#include <string.h>
void show(double number[], int count, int i);
int main(void)
{
double number[12] = {0};
int j = 0;
int i = 0;
char answer = 'n';
printf("Input:\n");
do
{
scanf("%lf",&number[i++]);
printf("Do you want to enter another?(y/n):");
scanf(" %c",&answer);
}while(i<12 && answer == 'y');
printf("请指示字符宽度:");
scanf("%d",&j);
show(number,j,i);
printf("\n");
return 0;
}这是main()函数检查发现前面都没有问题
do
{
str[i++] = '0'+count%10;
}while(count/= 10 >0);
在这里面count的值变成了839248924之类的坑爹的数字
是我格式用错了吗?不会吧

各位大牛可以调试一下
如果找出错误了请帮忙讲解一下,谢谢。
元方,你怎么看?
元方:太坑爹了!!!










楼主好好调试吧,确认下你的的代码肯定是有问题的~~
