会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Chan's blog
2023年4月16日
C++实现多线程
摘要: #include <iostream> #include <chrono> #include <thread> void printNumbers1() { for (int i = 1; i <= 10000; i++) { std::cout << "Thread 1: " << i << st
阅读全文
posted @ 2023-04-16 14:59 Z_Chan
阅读(37)
评论(0)
推荐(0)
C++ auto关键字
摘要: auto 是 C++11 中新增的一种类型推导关键字,可以根据变量的初始化表达式,自动推导出相应的类型。使用 auto 可以简化代码,减少类型错误的发生,提高代码的可读性和可维护性。 下面是 auto 的使用示例,假设我们有一个整数变量 x,可以这样使用 auto 进行类型推导: auto x =
阅读全文
posted @ 2023-04-16 14:49 Z_Chan
阅读(26)
评论(0)
推荐(0)
C++动态数组(vector.h)
摘要: #include <iostream> #include <vector> int main() { std::vector<std::string> con; con.push_back("9999"); std::cout<<con[0]; return 0; } vector搞了一个多态,你可
阅读全文
posted @ 2023-04-16 14:35 Z_Chan
阅读(53)
评论(0)
推荐(0)
C++的namespace
摘要: 这个也是和Java不同的地方,作用是为了防止类的名字冲突 #include <iostream> namespace myspace{ class A{ public: std::string head; private: std::string body; }; } namespace myspa
阅读全文
posted @ 2023-04-16 14:15 Z_Chan
阅读(20)
评论(0)
推荐(0)
C语言的预处理器
摘要: 这个是用来include的防止多次重复include #ifndef A_H #define A_H int test(){ } #endif
阅读全文
posted @ 2023-04-16 14:03 Z_Chan
阅读(17)
评论(0)
推荐(0)
C++访问控制public private
摘要: #include <iostream> class A{ public: std::string head; private: std::string body; }; int main() { A a; a.head="888"; a.body="999"; return 0; } 报错结果 ma
阅读全文
posted @ 2023-04-16 13:37 Z_Chan
阅读(17)
评论(0)
推荐(0)
C++中的继承
摘要: #include <iostream> class A{ public: std::string head; void hello(std::string str){ std::cout<<str<<head<<std::endl; } }; int main() { A a; std::strin
阅读全文
posted @ 2023-04-16 13:29 Z_Chan
阅读(14)
评论(0)
推荐(0)
导航
首页
新随笔
联系
订阅
管理
公告