自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 分别用结构体指针变量和结构体引用作为函数参数,计算一组学生的平均成绩和不及格人数。

#include#includeusing namespace std;typedef struct Student{ int ID;string name;double score;} stu;stu s[100];void calculate(stu p[],int n,double &aver,int &number){double sum=0;fo...

2019-04-19 12:23:16 4810

原创 定义一个Book(图书)类,在该类定义中包括: (1)数据成员:bookname(书名)、price(价格)和number(存书数量)。 (2)成员函数:display(显示图书的情况;borrow(

#include #includeusing namespace std;class Book{public:Book(string name,int p,int n);//构造函数void borrow();//借书void restore();//还书void disp();//显示剩余产品数量private:string bookname;//书名int price;...

2019-04-19 12:21:22 32558

原创 两种方法:友元函数和一般函数 定义一个Point类,求两点之间的距离。

一般函数:#include #include using namespace std;class Point{public:Point(double a, double b);double Getx(){return x;};double Gety(){return y;};private:double x;double y;};Point::Point(double ...

2019-04-19 12:19:42 5204

原创 定义一个MyString类,实现两个字符串相加。要求定义类的数据成员为字符指针,实现深拷贝函数。

#include using namespace std;class MyString{public:MyString(chars1, char s2);void add_str1_and_str2();void disp();private:char *str1;char str2;char str3;};MyString::MyString(char s1, char...

2019-04-19 12:18:30 4166

原创 设计一个圆类circle和一个桌子类table,另设计一个圆桌类roundtable,它是前面两个类的派生类,要求输出一个圆桌的高度、面积和颜色等数据。

#include#includeusing namespace std;class circle{public:circle(double m){ R = m; }double getarea(){ return RR3.14; }private:double R;};class table{public:table(double d){ H = d; }double...

2019-04-19 12:14:20 6719

原创 设有下面关于点Point类的定义,请在此基础上派生出一个正方形Square类,用以描述正方形左上角的位置和正方形的边长,并能够计算正方形的面积。 class Point { public: vo

#include#includeusing namespace std;class Point{public: void setxy(int x0, int y0) { x = x0; y = y0; }int getx() { return x; }int gety() { return y; }private: int x, y;};class Square:public ...

2019-04-19 12:12:46 3300

原创 编写一个学生和教师数据的输入和显示程序,学生数据有编号、姓名、班级和成绩,教师数据有编号、姓名、职称和部门。实验要求:将编号、姓名输入和显示设计成一个类Person,并作为学生数据操作类student

编写一个学生和教师数据的输入和显示程序,学生数据有编号、姓名、班级和成绩,教师数据有编号、姓名、职称和部门。实验要求:将编号、姓名输入和显示设计成一个类Person,并作为学生数据操作类student和教师数据操作类teacher的基类。#include#includeusing namespace std;class Person{public:Person(string ...

2019-04-19 12:11:38 18879 1

原创 N条直线所划分的平面个数

#include <stdio.h>#include <stdlib.h>int lines(int n){if(n==1)return 2;elsereturn n+lines(n-1);}int main(){int n,m;printf(“Please enter the number of lines\n”);scanf("%d",&amp...

2019-01-02 11:59:43 290

原创 5000单词查询(文件)

#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct English{char word[30];char paraphrase[100];}ENG;int main(){ENG search[5000];char fname[30],word[30];...

2019-01-02 11:57:42 422

原创 学生信息读取、查询及排序(文件)

#include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct student{char id[20];char name[10];int cs;int ms;int es;//cs为语文成绩,ms为数学成绩,es为英语成绩int sum;int ranking;...

2019-01-02 11:56:27 653

原创 两个多项式加减(用数组进行降幂排序)

#include <stdio.h>#include <stdlib.h>#define NEW (node*)malloc(sizeof(node))typedef struct Node{float conf;int exp;struct Node*next;} node;node a[20],b[20],temp;nodecreatah()//创...

2018-12-22 15:06:07 712

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除