【发布时间】:2013-02-02 23:36:42
【问题描述】:
我正在尝试将 100 个 lf 值的数组打印成十列。我计划在每行中达到第十个数据值时插入一个新行,但是我的 if 语句有问题。 “左操作数必须是 1 值”是我一直遇到的错误。 代码如下:
for (x=0; x<100; x++)
{
if (x % 10 = 0)
{
printf("\n");
}
printf("|%-6.2lf|", i[x]);
}
有没有更简洁的方法来做到这一点?
【问题讨论】:
标签: c loops multiple-columns modulus output-formatting