04 2022 档案

摘要:错误:invalid initialization of reference of type 'const Quote&' from expression of type 'const key_type {aka const std::shared_ptr<Quote>}' 解释:用const st 阅读全文
posted @ 2022-04-28 21:56 菠萝超级酸 阅读(1100) 评论(0) 推荐(0) 编辑
摘要:将实现同一功能的多个算法封装成多个不同的类,调用时更加方便,且避免条件语句的使用。 使用Context类来决定要使用哪个算法类,使用多态实现。通过在构造Context类时指定哪个算法类来实现选择功能。 Strategy类为纯虚类,用来派生不同的算法类。 #include <iostream> usi 阅读全文
posted @ 2022-04-09 23:01 菠萝超级酸 阅读(23) 评论(0) 推荐(0) 编辑
摘要:第一版: 简单实现 在int main 主函数中读取数据,使用switch语句分别进行操作。不同操作用类实现。 #include <iostream> using namespace std; static int num_a; static int num_b; static char op; v 阅读全文
posted @ 2022-04-09 22:55 菠萝超级酸 阅读(25) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <stdio.h> using namespace std; int main(int argc, char *argv[]) { int a=0x1234; //小端 34 12 char c=(char)(a); //判断是大端还是小端, 阅读全文
posted @ 2022-04-01 18:57 菠萝超级酸 阅读(509) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示