C++ 入门 怎么这都错 ?

[复制链接]
查看11 | 回复3 | 2009-7-30 13:26:33 | 显示全部楼层 |阅读模式
C++ 写
main()
{
printf("This is a program /n")
}
--------------------Configuration: 11 - Win32 Debug--------------------
Compiling...
1.cpp
d:\microsoft visual studio\myprojects\11\1.cpp(3) : error C2065: 'printf' : undeclared identifier
d:\microsoft visual studio\myprojects\11\1.cpp(4) : error C2143: syntax error : missing ';' before '}'
d:\microsoft visual studio\myprojects\11\1.cpp(4) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
1.obj - 1 error(s), 0 warning(s)

回复

使用道具 举报

千问 | 2009-7-30 13:26:33 | 显示全部楼层
#includeint main(){ printf("This is a program\n");}帮你改成这样,还有,后面那里是\n,不是/n,如果是/n,那么输出就是:This is a program /n这样了。...
回复

使用道具 举报

千问 | 2009-7-30 13:26:33 | 显示全部楼层
这个问题很无语,你刚开始最好按照例子做...
回复

使用道具 举报

千问 | 2009-7-30 13:26:33 | 显示全部楼层
你太菜了吧...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行