摘要: 实验一:代码: task1.cpp: #include <algorithm> #include <iostream> #include <stdexcept> #include <vector> #include "contestant.hpp" #include "utils.hpp" cons 阅读全文
posted @ 2025-12-23 22:51 唐文鑫 阅读(4) 评论(1) 推荐(0)
摘要: 实验一: 代码:task1.cpp: #include <memory> #include <iostream> #include <vector> #include "publisher.hpp" void test1() { std::vector<Publisher *> v; v.push_ 阅读全文
posted @ 2025-12-16 21:22 唐文鑫 阅读(5) 评论(1) 推荐(0)
摘要: 任务一:代码:task.cpp: #include <iostream> #include <string> #include "GradeCalc.hpp" void test() { GradeCalc c1("OOP"); std::cout << "录入成绩:\n"; c1.input(5) 阅读全文
posted @ 2025-12-02 22:56 唐文鑫 阅读(9) 评论(1) 推荐(0)
摘要: 实验一: button.hpp代码: #pragma once #include <iostream> #include <string> class Button { public: Button(const std::string &label_); const std::string& get 阅读全文
posted @ 2025-11-24 22:44 唐文鑫 阅读(9) 评论(1) 推荐(0)
摘要: 任务一: 代码: #pragma once #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = 0, int y = 0); // 普通构造函数 T(const T &t); // 复制构造函数 T(T &&t); / 阅读全文
posted @ 2025-10-28 19:51 唐文鑫 阅读(9) 评论(1) 推荐(0)
摘要: 任务1:代码: #include <iostream> #include <string> #include <vector> #include <algorithm> template<typename T> void output(const T &c); void test1(); void 阅读全文
posted @ 2025-10-17 18:34 唐文鑫 阅读(14) 评论(1) 推荐(0)
摘要: 实验四: #include<stdio.h> #define N 100 int main(){ int m=0,i,num=0 ; char a[N] ; FILE *fp ; fp=fopen("data4.txt","r") ; if(!fp){ printf("failed to open. 阅读全文
posted @ 2024-12-30 19:04 唐文鑫 阅读(16) 评论(0) 推荐(0)
摘要: 实验一: // P286例8.17 // 对教材示例代码作了微调,把输出学生信息单独编写成一个函数模块 // 打印不及格学生信息、打印所有学生信息均调用该模块实现 #include <stdio.h> #include <string.h> #define N 3 // 运行程序输入测试时,可以把N 阅读全文
posted @ 2024-12-22 16:43 唐文鑫 阅读(22) 评论(0) 推荐(0)
摘要: 实验一: #include <stdio.h> #define N 5 void input(int x[], int n); void output(int x[], int n); void find_min_max(int x[], int n, int *pmin, int *pmax); 阅读全文
posted @ 2024-12-08 17:14 唐文鑫 阅读(25) 评论(0) 推荐(0)
摘要: 实验一: #include<stdio.h> #define N 4 #define M 2 void test1(){ int x[N] = {1,9,8,4}; int i; printf("sizeof(x)=%d\n",sizeof(x)); for(i=0;i<N;++i) printf( 阅读全文
posted @ 2024-11-10 16:12 唐文鑫 阅读(47) 评论(0) 推荐(0)