摘要: 实验任务一: 1 #pragma once 2 #include <iomanip> 3 #include <iostream> 4 #include <string> 5 6 struct Contestant { 7 long id; // 学号 8 std::string name; // 姓 阅读全文
posted @ 2025-12-21 21:09 yahuao 阅读(6) 评论(1) 推荐(0)
摘要: 实验一: 1 #include <memory> 2 #include <iostream> 3 #include <vector> 4 #include "publisher.hpp" 5 6 void test1() { 7 std::vector<Publisher *> v; 8 9 v.p 阅读全文
posted @ 2025-12-16 19:24 yahuao 阅读(6) 评论(1) 推荐(0)
摘要: 试验任务一: 1 #pragma once 2 3 #include <vector> 4 #include <array> 5 #include <string> 6 7 class GradeCalc { 8 public: 9 GradeCalc(const std::string &cnam 阅读全文
posted @ 2025-12-02 20:52 yahuao 阅读(8) 评论(1) 推荐(0)
摘要: 实验任务一: 1 #pragma once 2 #include <iostream> 3 #include <string> 4 5 class Button { 6 public: 7 Button(const std::string &label_); 8 const std::string& 阅读全文
posted @ 2025-11-25 21:15 yahuao 阅读(6) 评论(1) 推荐(0)
摘要: 试验任务一: 问题一:不能 C++ 编译遵循 “先声明后使用” 原则,即使func在类内被声明为友元函数,也只能给他授予访问权限,而不是在全局域声明函数原型,因此task1.cpp找不到该函数,出现报错。 问题二: 普通构造函数:功能:初始化对象 调用时机:创建对象。 复制构造函数:功能:用已存在对 阅读全文
posted @ 2025-10-26 16:03 yahuao 阅读(8) 评论(1) 推荐(0)
摘要: 实验任务一: 源代码: #include <iostream> #include <string> #include <vector> #include <algorithm> // 模板函数声明 template<typename T> void output(const T &c); void 阅读全文
posted @ 2025-10-16 23:09 yahuao 阅读(15) 评论(1) 推荐(0)
摘要: https://www.cnblogs.com/yahuao 阅读全文
posted @ 2025-10-12 10:36 yahuao 阅读(12) 评论(0) 推荐(0)