菜鸟求教!一个小程序

zgqiangha 2008-06-13 09:47:34

#include <iostream.h>
class mfc()
{
public:
void a() {cout <<"a a a !!!!"<<endl;}
void b() {cout <<"b b b @@@@"<<endl;}
};
void main()
{
mfc c;
c.a();
}

刚接触,请大家帮我看看,错在哪啊
...全文
83 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zgqiangha 2008-06-13
  • 打赏
  • 举报
回复
多谢大家
shuiyan 2008-06-13
  • 打赏
  • 举报
回复
class mfc后面怎么加括号了????
class mfc后面怎么加括号了????
class mfc后面怎么加括号了????
zgqiangha 2008-06-13
  • 打赏
  • 举报
回复
晕!!!!失误。。。
还有,刚才二楼和三楼都说要加上using namespace std;
为什么要加上这个啊
mfc后面的括号去了之后
还有一个错误
E:\adm\VC++\ex22\ex22.cpp(2) : error C2871: 'std' : does not exist or is not a namespace
把using namespace std;去掉
就编译通过了。。。
hopeclass_shych 2008-06-13
  • 打赏
  • 举报
回复
#include <iostream>
using namespace std;

class mfc()
{
public:
void a()
{
cout < <"a a a !!!!" < <endl;
}
void b()
{
cout < <"b b b @@@@" < <endl;
}
};
void main()
{
mfc c;
c.a();
}
zgqiangha 2008-06-13
  • 打赏
  • 举报
回复
#include <iostream.h>
using namespace std;
class mfc()
{
public:
void a() {cout <<"a a a !!!!" <<endl;}
void b() {cout <<"b b b @@@@" <<endl;}
};
void main()
{
mfc c;
c.a();
}
加上了,但还出现错误
如下:
Compiling...
ex22.cpp
E:\adm\VC++\ex22\ex22.cpp(2) : error C2871: 'std' : does not exist or is not a namespace
E:\adm\VC++\ex22\ex22.cpp(5) : error C2143: syntax error : missing ';' before 'public'
E:\adm\VC++\ex22\ex22.cpp(6) : error C2143: syntax error : missing ';' before '{'
E:\adm\VC++\ex22\ex22.cpp(7) : error C2601: 'b' : local function definitions are illegal
E:\adm\VC++\ex22\ex22.cpp(11) : error C2146: syntax error : missing ';' before identifier 'c'
E:\adm\VC++\ex22\ex22.cpp(11) : warning C4551: function call missing argument list
E:\adm\VC++\ex22\ex22.cpp(11) : error C2065: 'c' : undeclared identifier
E:\adm\VC++\ex22\ex22.cpp(12) : error C2228: left of '.a' must have class/struct/union type
Error executing cl.exe.

ex22.exe - 7 error(s), 1 warning(s)
self_control 2008-06-13
  • 打赏
  • 举报
回复
为什么mfc后面要加括号呢?
babyvox1999 2008-06-13
  • 打赏
  • 举报
回复
+上using namespace std;
<<中间不要空格
洛儿胡 2008-06-13
  • 打赏
  • 举报
回复
#include <iostream>
using namespace std;
class mfc {
public:
void a() {cout <<"a a a !!!!" <<endl;}
void b() {cout <<"b b b @@@@" <<endl;}
};
void main()
{
mfc c;
c.a();
}

64,641

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧