运行错误,求助
错误报告LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/asdff.exe : fatal error LNK1120: 1 unresolved externals
源代码#include <stdio.h>
int mian(void)
{
int cookies= 5;
int cookie_calories=125;
int total_eaten=0;
int eaten =2;
cookies= cookies-eaten;
total_eaten=total_eaten+eaten;
printf("\nI hvae eaten %d cookies.There are%d cookies left",eaten,cookies);
eaten=3;
cookies = cookies-eaten;
total_eaten = total_eaten + eaten;
printf("\nTotal energy consumed is %d calories.\n",total_eaten*cookie_calories);
return 0 ;
} 你那个 main 打错了{:9_239:} 本帖最后由 joker11111 于 2016-9-7 16:16 编辑
大哥,main写成mian了,估计是手残了一下,哈哈,可以理解,毕竟大家都手残过{:10_247:}
另外建议程序里加些换行可以章程序看的更加清楚,明了,头文件引用是一块,变量定义是一块,类似a=b这种语句可以写成a = b, 还有for(i = 1; i < 6; i++),空格的合理使用也是比较重要的,建议你看以看看《高质量c/c++编程指南》这本书,没有资源的话留言给你分享!
#include <stdio.h>
int main(void)
{
int cookies = 5;
int cookie_calories = 125;
int total_eaten = 0;
int eaten = 2;
cookies = cookies - eaten;
total_eaten = total_eaten + eaten;
printf("\nI hvae eaten %d cookies. There are%d cookies left", eaten, cookies);
eaten = 3;
cookies = cookies - eaten;
total_eaten = total_eaten + eaten;
printf("\nTotal energy consumed is %d calories. \n", total_eaten * cookie_calories);
return 0 ;
} DarkSE 发表于 2016-9-7 16:08
你那个 main 打错了
知道了。。。{:5_100:} joker11111 发表于 2016-9-7 16:10
大哥,main写成mian了,估计是手残了一下,哈哈,可以理解,毕竟大家都手残过
另外建议程序里 ...
知道了。。。{:5_99:}
页:
[1]