在输入的C结束时的预期宣言或声明 [英] Expected Declaration or Statement at end of input C

查看:1367
本文介绍了在输入的C结束时的预期宣言或声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试打印随机值的10x4表。进出口新的C和仍然没有真正unserstand如何嵌套在C循环。即时猜测那里有一个大括号的地方一个错误,但IMN不能肯定。任何帮助吗?

im trying to print a 10x4 table of random values. Im new to C and still dont really unserstand how to nest loops in c. im guessing theres an error with a curly brace somewhere but imn not sure. any help?

#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;

}

错误说,这是在最后一行

the error says it is in the last line

推荐答案

修改

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; 
} 

这篇关于在输入的C结束时的预期宣言或声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆