C语言在最后一个括号报错

main ()
{
printf("F the world ~!!\n");
}
为嘛最后一个大括号会报错捏 。。。。

你好!!
你是在MFC的方式下建立的 02.cpp 文件吗
你试试下面的方法吧:
方法1:右键单击项目工程中的cpp文件,在菜单Project->Settings->C/C++->Precompile Header,
设置为第一项:Not using precompile headers。
方法2:在.cpp文件开头添加包含文件 #include"stdafx.h"
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-15
#include <stdio.h>
int main (void)
{
printf("F the world ~!! \n");

return 0;
}
这样就不会报错了,头文件没写,printf()后的分号也有有问题哦,建议初学c语言按照最新标准c99,养成好习惯。
第2个回答  2013-10-15
printf("F the world ~!!\n");里面最后的分号是中文的,必须是英文的才行追问

我改了 英文的也不行的说
d:\program files\microsoft visual studio\myprojects\02\02.cpp(6) : fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错.

追答

你把你的代码全都贴出来看看

追问

我的全部代码就在上面捏。。

追答

unexpected end of file 我碰到这种提示一般都是因为标点符号使用成中文照成的,你把printf("F the world ~!!\n");这一句注释掉,看看还报错不

本回答被提问者采纳
第3个回答  2013-10-15
很明显,你的printf语句最后的分号是中文字符,不是英文字符。还有main()函数是要前缀类型的,像void,int等,最好写上
相似回答