| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 597 人关注过本帖
标题:哪个大侠能说说这个using namespace std怎么就错呢
取消只看楼主 加入收藏
yyblackyy
Rank: 6Rank: 6
等 级:侠之大者
帖 子:98
专家分:457
注 册:2010-3-31
结帖率:100%
收藏
 问题点数:0 回复次数:1 
哪个大侠能说说这个using namespace std怎么就错呢
#include <iostream.h>
class Date
{
   int mo, da, yr;
public:
   Date( int m, int d, int y )
   {
      mo = m; da = d; yr = y;
   }
   friend ostream& operator<< (ostream& os, Date& dt );
};
ostream& operator<< ( ostream& os, Date& dt )
{
    os << dt.mo << '/' << dt.da << '/' << dt.yr;
   return os;
}
int main()
{
    Date d(1965,12,25);
    cout<<d<<endl;
   
    return 0;
}
*****************************************************************************************
#include <iostream>
using namespace std;
class Date
{
   int mo, da, yr;
public:
   Date( int m, int d, int y )
   {
      mo = m; da = d; yr = y;
   }
   friend ostream& operator<< (ostream& os, Date& dt );
};
ostream& operator<< ( ostream& os, Date& dt )
{
    os << dt.mo << '/' << dt.da << '/' << dt.yr;
   return os;
}
int main()
{
    Date d(1965,12,25);
    cout<<d<<endl;
   
    return 0;
}
*******************************
新手囊中羞涩。。。。请大侠不要见怪啊*^_^*
搜索更多相关主题的帖子: namespace std using 
2010-03-31 14:45
yyblackyy
Rank: 6Rank: 6
等 级:侠之大者
帖 子:98
专家分:457
注 册:2010-3-31
收藏
得分:0 
懂了,我自己也试了一下,大侠出手就是不同啊。。。
2010-03-31 17:04
快速回复:哪个大侠能说说这个using namespace std怎么就错呢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011895 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved