这是我的代码
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int n=0;
do
printf("Height of Pyramid:\n");
n = GetInt();
while (n>=0);
printf("you picked %i", n);
}
这是我的错误
mario.c:8:9: error: expected 'while' in do/while loop n = GetInt(); ^ mario.c:6:5: note: to match this 'do' do ^
答案 0 :(得分:2)
您忘记包含大括号{...}
。替换为:
do {
printf("Height of Pyramid:\n");
n = GetInt();
} while (n>=0);