马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <stdlib.h>
int main()
{
double *ptd;
int max;
int number;
int i=0;
puts("What is the maximum number of tpye double entries?\n");
if(scanf("%d",&max)!=1)
{
puts("Number not correctly enterd --bye.");
exit(EXIT_FAILURE);
}
ptd=(double *)malloc(max * sizeof(double));
if(ptd==NULL)
{
puts("Memory alocation faliled.Goodbye.");
exit(EXIT_FAILURE);
}
/*ptd 现在是指向有max元素的数组*/
puts("Enter the values(q to quit)");
while(i<max&&scanf("%lf",&ptd[i])==1)
++i;
printf("Here are your %d entries:\n",number=i);
for(i=0;i<number;i++)
{
printf("%7.2f",ptd[i]);
if(i%7==6)
putchar('\n');
}
if(i%7!=0)
putchar('\n');
puts("Done.");
free(ptd);
return 0;
}
这段代码里面的if i%7==6是神马意思? |