摘要: 实验任务2 Person.hpp #ifndef PERSON_HPP #define PERSON_HPP #include<iomanip> #include<iostream> #include<string> using namespace std; class Person{ public 阅读全文
posted @ 2021-12-12 20:17 sensenzd 阅读(14) 评论(2) 推荐(0) 编辑
摘要: 实验任务2 #include <iostream> #include <typeinfo> // definitation of Graph class Graph { public: virtual void draw() { std::cout << "Graph::draw() : just 阅读全文
posted @ 2021-11-27 15:26 sensenzd 阅读(17) 评论(3) 推荐(0) 编辑
摘要: 实验任务4 vector_int.hpp #ifndef VECTOR_INT_HPP #define VECTOR_INT_HPP #include<iostream> using namespace std; class Vector_int{ public: Vector_int(int n0 阅读全文
posted @ 2021-11-05 20:49 sensenzd 阅读(25) 评论(3) 推荐(0) 编辑
摘要: 实验任务5 #ifndef INFO_HPP #define INFO_HPP #include<iostream> #include<string> using namespace std; struct Info{ public: Info(string nn0="a",string c0="b 阅读全文
posted @ 2021-10-27 15:59 sensenzd 阅读(99) 评论(3) 推荐(0) 编辑
摘要: 实验结论 实验任务3 #ifndef COMPLEX_HPP #define COMPLEX_HPP #include <iostream> #include <cmath> using namespace std; class Complex{ public: Complex(double a=0 阅读全文
posted @ 2021-10-22 23:44 sensenzd 阅读(38) 评论(4) 推荐(0) 编辑
摘要: 三.实验3 1.运行程序,屏幕上正确输出了按分数高→低排序的信息,同时,在当前路径下,生成了文本文件file3.dat。 2.用记事本程序打开文件file3.dat,里面的数据信息正确,并且是直观可读的。 四.实验4 子任务1 运行程序,屏幕上正确输出了按分数由高到底排序的学生信息。同时,在当前路径 阅读全文
posted @ 2020-12-29 00:18 sensenzd 阅读(65) 评论(2) 推荐(0) 编辑
摘要: 一.实验任务1 #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 3 typedef struct student { int id; char name[20]; char subject[20]; float pe 阅读全文
posted @ 2020-12-18 00:47 sensenzd 阅读(110) 评论(1) 推荐(0) 编辑
摘要: 一.实验任务1 #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-15 00:36 sensenzd 阅读(108) 评论(1) 推荐(0) 编辑
摘要: 1.实验任务1 这个应用中,一元二次方程的根不能设计成以函数返回值的方式返回给主调函数。 2.实验任务2 // 利用局部static变量计算阶乘 #include <stdio.h> long long fac(int n); // 函数声明 int main() { int i,n; printf 阅读全文
posted @ 2020-11-28 23:56 sensenzd 阅读(55) 评论(1) 推荐(0) 编辑
摘要: 1.实验任务1 #include <math.h> #include <stdio.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f 阅读全文
posted @ 2020-11-14 23:58 sensenzd 阅读(153) 评论(0) 推荐(0) 编辑