为了账号安全,请及时绑定邮箱和手机立即绑定

问题 出现在哪儿?

问题 出现在哪儿?

C++
慕仰2239611 2017-06-21 20:04:54
#include<stdlib.h>#include<iostream>using namespace std;namespace A{ int x=1; void fun() { cout<<"A"<<endl: }}  namespace B  {     int x=2;  void fun()  { cout<<"B"<<endl;  }}int main(void){   cout<<A::x<<endl;   B::fun(); system("pause"); return 0;}
查看完整描述

3 回答

已采纳
?
书旅

TA贡献238条经验 获得超101个赞

敲代码仔细一点,cout<<"A"<<endl:   这一行后边是分号,不是冒号

查看完整回答
反对 回复 2017-06-21
?
慕仰2239611

TA贡献2条经验 获得超0个赞

1>  正在创建“Debug\test2.unsuccessfulbuild”,因为已指定“AlwaysCreate”。

1>ClCompile:

1>  test.cpp

1>c:\users\administrator\desktop\test2\test.cpp(9): error C2143: 语法错误 : 缺少“;”(在“:”的前面)

1>c:\users\administrator\desktop\test2\test.cpp(9): error C2143: 语法错误 : 缺少“;”(在“:”的前面)

1>

1>生成失败。

1>

1>已用时间 00:00:00.59

========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========


查看完整回答
反对 回复 2017-06-21
  • 3 回答
  • 0 关注
  • 1769 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信