摘要: 任务二: //Person.hpp 1 #ifndef _PERSON_HPP_ 2 #define _PERSON_HPP_ 3 4 #include<iostream> 5 #include<cstring> 6 using namespace std; 7 class Person{ 8 pr 阅读全文
posted @ 2021-12-13 22:31 Xx0 阅读(33) 评论(3) 推荐(0) 编辑
摘要: 任务二: 未加virtual 加virtual之后 同名覆盖原则:基类中的函数和派生类的函数重名时,若未强行指名,则通过派生类对象使用的是派生类的同名成员 二元作用域分辨符:当派生类与基类中有相同成员时,如果要通过派生类对象访问基类中被隐藏的同名成员,可以用基类名和作用域分辨符来限定 类型兼容原则: 阅读全文
posted @ 2021-11-25 21:11 Xx0 阅读(24) 评论(3) 推荐(0) 编辑
摘要: 任务四: //vector_int.hpp 1 #ifndef BALL_H 2 #define BALL_H 3 4 #include<iostream> 5 #include<cstdlib> 6 7 using namespace std; 8 9 class Vector_int{ 10 p 阅读全文
posted @ 2021-11-08 19:20 Xx0 阅读(35) 评论(3) 推荐(0) 编辑
摘要: 任务五: //Info.hpp 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 5 class Info{ 6 private: 7 string nickname; 8 string contact; 9 stri 阅读全文
posted @ 2021-11-02 23:42 Xx0 阅读(21) 评论(3) 推荐(0) 编辑
摘要: 实验任务三 Complex.hpp 1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 class Complex{ 5 private: 6 double real, imag; 7 public: 8 Complex(d 阅读全文
posted @ 2021-10-24 23:02 Xx0 阅读(39) 评论(3) 推荐(0) 编辑
摘要: 任务三 正确输出,生成了文本文件file3.dat,数据信息正确,直观可读 任务四 子任务一: 正确输出,生成了文本文件file3.dat,数据信息正确,不能直观可读 子任务二: #include<stdio.h> #include<stdlib.h> #define N 10 typedef st 阅读全文
posted @ 2020-12-30 11:02 Xx0 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 任务一 // P280例8.15 // 对教材上的程序作了微调整,把输出学生信息单独编写成一个函数模块 // 打印不及格学生信息和所有学生信息程分别调用 #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 3 // 运行 阅读全文
posted @ 2020-12-21 23:26 Xx0 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 任务一 #include<stdio.h> const int N = 3; int main(){ int a[N] = {1, 2, 3}; int i; printf("通过数组名及下标直接访问数组元素:\n"); for(i=0; i<N; i++) printf("%d: %d\n", & 阅读全文
posted @ 2020-12-16 14:53 Xx0 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 任务一: 一元二次方程的根不能设计成以函数返回值的方式返回给主调函数,因为函数的返回值至多有一个 任务二: #include<stdio.h> long long fac(int n); int main(){ int i, n; printf("Enter n: "); scanf("%d", & 阅读全文
posted @ 2020-11-29 23:29 Xx0 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 任务1 //ex1.cpp #include<stdio.h> int main(){ int a=5, b=7, c=100, d, e, f; d=a/b*c; e=a*c/b; f=c/b*a; printf("d=%d, e=%d, f=%d",d,e,f); return 0; } d=5 阅读全文
posted @ 2020-11-01 15:47 Xx0 阅读(77) 评论(3) 推荐(0) 编辑