3.1命名空间using声明
头文件:
#ifndef C___primer___Header_h
#define C___primer___Header_h
using std::cin;
using std::cout;
using std::endl;
//using namespace std;
#endif
#include <iostream>
#include "Header.h"
int main ()
{
cout<<"enter the two number: "<<endl;
int a,b;
cin>>a>>b;
cout<<"the product of the two number is:"<<a*b<<endl;
}
C++使用命名空间示例
本文通过一个简单的C++程序示例展示了如何在代码中使用命名空间来简化标准库元素的引用。程序实现了基本的输入输出操作,并计算两个整数的乘积。

被折叠的 条评论
为什么被折叠?



