输入C结尾处的预期声明或声明

时间:2014-01-25 21:34:35

标签: c

我试图打印10x4随机值表。我是C的新手,但仍然不知道如何在c中嵌套循环。我猜测某个地方有一个大括号的错误但是我不确定。有什么帮助吗?

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int row = 0, column = 0 ;
    while (column < 11)
    {
        row = 1;
        while (row < 5)
        {
             printf ("%lf", random());
             row = row + 1;
    }
    column = column + 1;

}

错误说它在最后一行

1 个答案:

答案 0 :(得分:2)

更改

row = 1;
{
     while (row < 5)
        printf ("%f", random());
        row = row + 1;
}
 column = column + 1;

   row = 1;
   while (row < 5)
   {
        printf ("%f", random());
        row = row + 1;
   } 
    column = column + 1; 
}