读书人

请问VC.net2003下的控制台程序

发布时间: 2012-03-07 09:13:51 作者: rapoo

请教VC.net2003下的控制台程序
#include "stdafx.h "
class point
{
public:
int x;
int y;
void output()
{
cout < <x < <end1 < <y < <end1;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
point pt;
pt.x=5;
pt.y=5;
pt.output();
return 0;
}
我学的是VC6.0
在VC.net下写这个程序
编译不通过
高手指教


[解决办法]
class point
{
public:
int x;
int y;
void output()
{
cout < <x < <end1 < <y < <end1;
}
} <=======少了一个;号
int _tmain(int argc, _TCHAR* argv[])
{
point pt;
pt.x=5;
pt.y=5;
pt.output();
return 0;
}
[解决办法]
end1?
应该是endl是L,不是1
还有,你因该加上 include <iostream> using namespace std;
[解决办法]
如果你是

include <iostream.h>

改成

include <iostream>

using namespace std;



[解决办法]
把第一行 挪到第三行 namespace 是一个词 中间没有空格

读书人网 >C++

热点推荐