我正在编程的东西有问题。
我一遍又一遍地收到这个错误;
jharvard@appliance (~/Dropbox/pset1): make mario
clang -ggdb3 -O0 -std=c99 -Wall -Werror mario.c -lcs50 -lm -o mario
mario.c:23:5: error: expected identifier or '('
do
^
mario.c:32:1: error: expected identifier or '('
do
^
2 errors generated.
我在互联网上进行了搜索,但找不到问题所在。
删除 ;后int main(void)
没有帮助
这是我的代码:
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void);
//Ask User for Height, and check
int a, b, rows, height;
int a = 0;
int b = 0;
int rows = 1;
do
{
printf ("Height: ");
height = GetInt();
}
while (height <=0 || height > 23);
//build half pyramid
do
{
do
{
printf("r");
a++;
}
while (a < height - rows);
do
{
printf("#");
b++;
}
while (b < rows + 1);
printf("\n");
rows++;
while (rows <= height);
}
我几天来一直试图解决这个问题,但我就是不明白!
提前非常感谢!
int main(void);
您刚刚宣布了main
。您需要定义它并在该定义中添加代码。
int main()
{
.....
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)