C++兔子朝东尾朝西
Reol、
这个作者很懒,什么都没留下…
展开
-
C++-编写一个学生和教师数据输入和显示程序 学生数据有编号、姓名、班号和成绩; 教师数据有编号、姓名、职称和部门。 要求将编号、姓名的输入和显示设计成一个类person,并作为学生数据操作类
C++语言题目:编写一个学生和教师数据输入和显示程序 学生数据有编号、姓名、班号和成绩; 教师数据有编号、姓名、职称和部门。 要求将编号、姓名的输入和显示设计成一个类person,并作为学生数据操作类student和教 师数据操作类teacher的基类。#include<iostream>#include <string>using std::cout;using std::endl;class person{public:..原创 2020-08-04 20:11:34 · 6534 阅读 · 10 评论 -
C++-实现函数模板的特化,要求能够对一个对象进行排序。
#include <cstdlib>#include <iostream>using namespace std;template <typename T>void sort(T* Iteam, int nCount){for (int i = 0; i < nCount; i++){for (int j = i + 1; j < nCount; j++){if (Iteam[..原创 2020-07-20 10:25:49 · 121 阅读 · 0 评论 -
C++-函数模板实现的冒泡排序算法
#include<iostream>#include<cstring>using namespace std;template <typename T>void show(T array[], int size) {int i, j;T temp;for (i = 0; i < size; i++) {for (j = 0; j < size - 1; j++) {if (array...原创 2020-07-17 17:57:01 · 1868 阅读 · 0 评论 -
C++-关于打印菱形的问题
#include <iostream>#include <cstdio>#include <cstdlib>using namespace std;int main(int* argc, char* argv[]){int line; // 菱形总行数int column; // 菱形总列数int i; // 当前行int j; // 当前列cout << "请输入菱形...原创 2020-07-17 17:56:18 · 303 阅读 · 0 评论 -
C++-题目:设计一个CDate类,要求满足如下要求:a)有带参构造函数b)可设置日期c)可运行日期加一天的操作d)有输出操作(用日/月/年格式输出日期)
#include<iostream>using namespace std;class CDate{public:CDate(int nYear = 0, int nMon = 0, int nDay = 0); //构造函数bool SetData(int nYear, int nMon = 0, int nDay = 0);// 设置日期函数void PrintData();// 打印日期函数bool AddDay(); /..原创 2020-07-17 17:55:32 · 1486 阅读 · 0 评论 -
C++-题目:学生的存储格式为姓名-性别-学号,教师的存储格式为姓名-性别-职工号, 但是小明作为一名学生的同时,也是一位教师,为了节省空间并增强代码复用性, 决定使用菱形继承,请设计一套类用于
02.题目:学生的存储格式为姓名-性别-学号,教师的存储格式为姓名-性别-职工号, 但是小明作为一名学生的同时,也是一位教师,为了节省空间并增强代码复用性, 决定使用菱形继承,请设计一套类用于解决这一问题并测试它#include <stdio.h>#include <iostream>using namespace std;class CBaseInfo {public:CBaseInfo(char *pName, int nSex)原创 2020-07-17 17:54:17 · 186 阅读 · 0 评论 -
C++-题目:设计一个圆类circle和一个桌子类table,另设计一个圆桌类roundtable,它是从前两个类派生的,要求输出一个圆桌的高度,面积和颜色等数据。
#include <iostream>using namespace std;class CCircle {public:CCircle() {};~CCircle() {};void CalcArea() { //求面积m_nArea = 3.14 * m_nR * m_nR;}double GetArea() { //获取面积return m_nArea;}void SetRadii(doub..原创 2020-07-17 17:53:01 · 1662 阅读 · 0 评论