做网站卖别人的软件可以吗,中国展陈公司前十名,dedecms网站地图模板怎么,钓鱼网站建设定义自己的命名空间 my_sapce#xff0c;在 my_sapce 中定义 string 类型的变量 s1#xff0c;再 定义一个函数 完成 对字符串的逆置 。
#include iostream//导入 标准命名空间#xff0c;cout 和 endl 标识符 存在于标准命名空间中
using namespace std;//定义了自…定义自己的命名空间 my_sapce在 my_sapce 中定义 string 类型的变量 s1再 定义一个函数 完成 对字符串的逆置 。
#include iostream//导入 标准命名空间cout 和 endl 标识符 存在于标准命名空间中
using namespace std;//定义了自己的命名空间mydata
namespace my_sapce {string s1hello world; //定义了一个字符串变量s1使用hello world初始化void han(string str); //函数声明
}
using namespace my_sapce; //全局导入 mydata 命名空间
int main() //主函数
{cout s1 endl;han(s1); //调用函数 hancout s1 endl; //输出 s1数据 回车return 0;
}
void my_sapce::han(string str){ //函数han 传参 字符串int m0; //字符串 起始位置int ns1.length()-1; //字符串最后一个位置char c; //三杯水临时存储数据while(s1.at(m)!s1.at(n)){ //while循环at按位访问字符串 两个值不相等为1cs1.at(n);s1.at(n)s1.at(m); //开始交换s1.at(m)c;m;n--;}
}