c++初学者问题

[复制链接]
查看11 | 回复5 | 2009-2-9 16:47:34 | 显示全部楼层 |阅读模式
本人初学C++
用的《C++ Primer》
现在做习题三:
编一个程序,在标准输出上打印“hello,world"
我照着书上弄的:
#include
int main()
{
std::cout <<"hello,world" << std::endl;
}
我用TC++3.1编译器
编译报错
#include
我又改为#include
为什么要这么改下才行?
改了之后 std::cout <<"hello,world" << std::endl;
还是报错
请高手指点下。

回复

使用道具 举报

千问 | 2009-2-9 16:47:34 | 显示全部楼层
TC++3.1?? C++ Primer这本书是建立在微软的VC++或者UNIX的GCC下的,TC现在都已经过时了 你没看C++ Primer的前言部分吗,那里说了有的时候相同的程序在不同的编译程序下的结果会有一点点的差别,虽然以上解答都对,但是建议还是用VC++来学习...
回复

使用道具 举报

千问 | 2009-2-9 16:47:34 | 显示全部楼层
你的程序在vc++上运行没有错...
回复

使用道具 举报

千问 | 2009-2-9 16:47:34 | 显示全部楼层
#includeusing namespace std;void main(){ cout<<"hello.world"<<endl;}...
回复

使用道具 举报

千问 | 2009-2-9 16:47:34 | 显示全部楼层
第一个#include "stdafx.h" int main(int argc, char* argv[]) { printf("Hello World!\n"); return 0; }第二个#include "stdafx.h"#include int main(int argc, c...
回复

使用道具 举报

千问 | 2009-2-9 16:47:34 | 显示全部楼层
#include int main(){ cout <<"hello,world" << endl; return 0;}...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行