【发布时间】:2014-02-05 01:33:59
【问题描述】:
以下是错误:
mario.c:23:25: error: expected identifier or ‘(’ before ‘int’
for (int levelCounter, int usrHeight, int paddIt = usrHeight - 1, char hashMaker, int hashCounter;(levelCounter <= usrHeight);)
^
mario.c:25:39: error: expected ‘)’ before ‘paddIt’
printf("%'' * paddIt %c*hashCounter"paddIt,hashMaker,hashCounter);
^
^ 标识编译器指出错误发生的位置。
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int usrHeight = 0;
int levelCounter = 0;
int paddIt = 0;
int hashCounter = 2;
char hashMaker = "#";
do
{
printf("How high?\n");
int usrHeight = GetInt();
}
while ( usrHeight > 23 || usrHeight < 0);
if ( usrHeight >= 0 && usrHeight <= 23);
{
printf("constructing...\n");
}
for (int levelCounter, int usrHeight, int paddIt = usrHeight - 1, char hashMaker, int hashCounter;(levelCounter <= usrHeight);)
*^ This is where the first error is occuring*
{
printf("%'' * paddIt %c*hashCounter"paddIt,hashMaker,hashCounter);
*^ And here is where the second is*
paddIt = paddIt - 1;
levelCounter = levelCounter + 1;
hashCounter = hashCounter + 1;
}
}
我到底做错了什么?
【问题讨论】:
-
哇,一团糟。甚至不知道从哪里开始。您为什么不删除代码并慢慢将其添加回来。