错误:编译时的预期标识符

时间:2017-01-09 20:26:48

标签: identifier greedy

这是我为学习新功能而编写的代码" round"。

 #include <stdio.h>
 #include <cs50.h>

 int main(void);
 float a = 0;
 float b = 0;
{

    do 
     {
         // Here we will ask fo the change.
         printf("How much change do I owe?\n");
         float a = GetFloat();
     }
     while (a <= 0);
    {
        // Use of new function round which will round off the float and conver it to int or any specified number format.
        float b = (int)round( a * 100);
        printf("%f\n", b);
    }
    return 0;
}

但它会出现以下错误

greedy.c:6:1:错误:预期的标识符或&#39;(&#39; { ^ 生成1个错误。 make:*** [贪心]错误1

1 个答案:

答案 0 :(得分:0)

看看你有一些语法和逻辑问题:

for(var key in data) {
     if(/^_gallery/.test(key))
    ... do something with obj[key]
 }