错误C2449和错误C2059
我正在尝试做一个关于打印带有上下边缘长度的梯形的程序。但是我不能执行我的代码来查看它是否工作。这是我的密码:错误C2449和错误C2059,c,C,我正在尝试做一个关于打印带有上下边缘长度的梯形的程序。但是我不能执行我的代码来查看它是否工作。这是我的密码: #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:");
#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;
}
#包括
int main(无效);
{
int top、bot、a、b;
printf(“请输入顶部的长度:”);
scanf(“%d”,顶部(&T);
printf(“请输入底部的长度:”);
scanf(“%d”和“bot”);
对于(a=top;a
这是我的错误信息:
错误C2059:语法错误:'}'错误C2449:在文件作用域中找到“{”(缺少函数头?删除
int main(void)
之后的;
从int main(void)
函数行中删除尾部的;
,这是无效语法
int main(void) // this is wrong here: ';'
{
...
改变
到
int main(void);
int main(void) //no semicolon