c - 在 Code Blocks IDE 中收到错误消息 "expected identifier or ' )' before ' }' token"

标签 c

我收到以下代码标题中的错误消息

int main()
{
  int day = 1;
  float penny = 0.01;
  while (day<32)
    printf("On Day %d you had %f dollars",day, penny);
    penny *=2;
    day++;

  }


    return 0;

感谢任何和所有帮助。 :D

最佳答案

while 后缺少 {return 0; 后缺少 }

int main()
{
  int day = 1;
  float penny = 0.01;
  while (day<32)
  {
     printf("On Day %d you had %f dollars",day, penny);
    penny *=2;
    day++;

  }

  return 0;
}

关于c - 在 Code Blocks IDE 中收到错误消息 "expected identifier or ' )' before ' }' token",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35282717/

相关文章:

c++ - 在 OSX 上相当于 Windows 的 QueryPerformanceCounter 是什么?

c++ - 如何找出哪些函数没有内联

c - 如何打印偶数正方形的表格?

从 Visual Basic 6 调用 C DLL : Double data type not working

c - C 和 C++ 的最佳调试工具

const char * 与 const char ** 函数参数

c - 如何正确实现 alarm() 方法来杀死 fork() 创建的所有工作进程?

C: strtof 返回 0.000,怎么了?

c - 使用指针对c中的字符串数组进行排序

c - 读取 float