当前位置: 首页 > news >正文

网站备案经验建网站需要多少钱和什么条件

网站备案经验,建网站需要多少钱和什么条件,公众号制作的网站开发,做网站流量的方法demo1只有类的情况下调用 下面写一个util.h 文件里面 // 定义宏防止编译器重复编译 #ifndef TEST_H #define TEST_H class Test{ public:void sum(int a, int b);int num(int a, int b);bool number();}; #endif // TEST_H 调用的时候首先要引入这个头文件 #include "u…

demo1只有类的情况下调用

下面写一个util.h 文件里面

// 定义宏防止编译器重复编译
#ifndef TEST_H
#define TEST_H
class Test{
public:void sum(int a, int b);int num(int a, int b);bool number();};
#endif // TEST_H

调用的时候首先要引入这个头文件 #include "util.h"

cpp 里面实现

#include <iostream>
#include <string>
#include "util.h"
using namespace std;// 实现Test类的sum成员函数
void Test::sum(int a,int b){cout << "The sum of " << a << " and " << b << " is: " << a + b << std::endl;
}
// 实现Test类的num成员函数
int Test::num(int a, int b) {return a * b;
}
// 实现Test类的number成员函数
bool Test::number() {return true;
}int main() {int a =3;int b =6;Test test;test.sum(a,b);int result = test.num(a,b);cout<< "num result" << result <<endl;bool isNumber = test.number();cout<< "number result" << isNumber <<endl;return 0;
}

demo2 有namespace的情况下调用

util.h 文件

// 定义宏防止编译器重复编译
#ifndef TEST_H
#define TEST_H
namespace common::comm::com {
class Test{
public:void sum(int a, int b);int num(int a, int b);bool number();};
}
#endif  

cpp 里面实现,这里不使用using namespace

#include <iostream>
#include <string>
#include "util.h"
using namespace std;// 实现Test类的sum成员函数
void common::comm::com::Test::sum(int a,int b){cout << "The sum of " << a << " and " << b << " is: " << a + b << std::endl;
}
// 实现Test类的num成员函数
int common::comm::com::Test::num(int a, int b) {return a * b;
}
// 实现Test类的number成员函数
bool common::comm::com::Test::number() {return true;
}int main() {int a =3;int b =6;common::comm::com::Test test;test.sum(a,b);int result = test.num(a,b);cout<< "num result" << result <<endl;bool isNumber = test.number();cout<< "number result" << isNumber <<endl;return 0;
}

使用using namespace

namespace common::comm::com {
// 实现Test类的sum成员函数
void Test::sum(int a,int b){cout << "The sum of " << a << " and " << b << " is: " << a + b << std::endl;
}
// 实现Test类的num成员函数
int Test::num(int a, int b) {return a * b;
}
// 实现Test类的number成员函数
bool Test::number() {return true;
}
}
int main() {int a =3;int b =6;using namespace common::comm::com;Test test;test.sum(a,b);int result = test.num(a,b);cout<< "num result" << result <<endl;bool isNumber = test.number();cout<< "number result" << isNumber <<endl;return 0;
}

实际用不用,根据个人习惯即可,不使用using namespace在每次调用时都写出完整的命名空间路径

把util.h 文件修改一层一层的

// 定义宏防止编译器重复编译
#ifndef TEST_H
#define TEST_H
namespace common{namespace comm{namespace com{class Test{public:void sum(int a, int b);int num(int a, int b);bool number();};}}
}
#endif  

实现里面的方法效果也是一样的

#include <iostream>
#include <string>
#include "util.h"
using namespace std;namespace common::comm::com {
// 实现Test类的sum成员函数
void Test::sum(int a,int b){cout << "The sum of " << a << " and " << b << " is: " << a + b << std::endl;
}
// 实现Test类的num成员函数
int Test::num(int a, int b) {return a * b;
}
// 实现Test类的number成员函数
bool Test::number() {return true;
}
}
int main() {int a =3;int b =6;using namespace common::comm::com;Test test;test.sum(a,b);int result = test.num(a,b);cout<< "num result" << result <<endl;bool isNumber = test.number();cout<< "number result" << isNumber <<endl;return 0;
}

或者

#include <iostream>
#include <string>
#include "util.h"
using namespace std;namespace common {namespace comm {namespace com {// 实现Test类的sum成员函数void Test::sum(int a, int b) {std::cout << "The sum of " << a << " and " << b << " is: " << a + b << std::endl;}int Test::num(int a, int b) {return a * b;}bool Test::number() {return true; // 示例返回true}} // 结束命名空间 com} // 结束命名空间 comm
} // 结束命名空间 common
int main() {int a =3;int b =6;using namespace common::comm::com;Test test;test.sum(a,b);int result = test.num(a,b);cout<< "num result" << result <<endl;bool isNumber = test.number();cout<< "number result" << isNumber <<endl;return 0;
}

http://www.yayakq.cn/news/356154/

相关文章:

  • 一次备案多个网站房产信息网显示已签约
  • 淄博网站优化价格公司门户网站建设特点
  • 淄博网站制作价格低wordpress检验上传的文档
  • 河源市建设厅网站制作的网站如何访问
  • 做相册哪个网站好用吗软件开发工程师证书图片
  • 四川城乡和住房建设厅官方网站开网店的流程和步骤
  • 网站漂浮广告怎么做百度做网站的电话
  • 预付网站建设费会计处理无锡鑫融建设网站
  • 做网站.服务器怎么买南宁手机做网站公司
  • 新开传奇网站刚开怎么查网站的备案
  • 厦门网站建设门户什么是oa系统
  • 怎么做一淘宝客网站吗赣州小程序开发公司
  • 网站网站开发成本企业大型网站开发网站模板设计
  • 网站策划书基本项目网页编辑软件有哪些?
  • 诸城哪有做公司网站和的用自己的电脑做视频网站吗
  • 电影网站源码accesscpancel面板搭建WordPress
  • 天津 网站建设怎么自己做直播网站
  • 厦门思明区建设局网站合肥市做网站多少钱
  • 国外网站打不开怎么解决昆明软件开发公司推荐
  • 广州做网站的企业上海公司购买新能源车条件
  • 怎么寻求网站建设巩义网站建设优化公司
  • 自己公司的网站怎么编辑wordpress 超过2m
  • 网站布局方式网站备案通过后
  • 专业网站推广引流网页无法访问手机
  • 网站建设启凡网易企业邮箱账号
  • 佛山信息技术网站开发系统炸了我成了系统
  • 网站建设需求说明书品牌推广是什么
  • 顺的网站建设信息徐州网站建设的特点
  • 个人风采网站制作建立网站 英语
  • 免费建站的网址不愁销路的小型加工厂项目年入百万