我正在尝试编写一个关于打印梯形及其顶部和底部边缘长度的程序。但我无法执行我的代码来查看它是否有效。这是我的代码:
#include <stdio.h>
int main(void);
{
int top, bot, a, b;
printf("Please enter the length of top:");
scanf("%d", &top);
printf("Please enter the length of bottom:");
scanf("%d", &bot);
for(a = top; a < bot; a++) {
for(b = top; b < a+1; b++) {
printf("* ");}
printf("\n");}
return 0;
}
这是我的错误文本:
错误 C2059:语法错误:'}'
错误 C2449:在文件范围内找到“{”(缺少函数头?)
最佳答案
从 int main(void)
函数行中删除尾随的 ;
,这不是有效的语法
int main(void) // this is wrong here: ';'
{
...
关于c - 错误 C2449 和错误 C2059,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26573630/