自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 折半查找

#include<stdio.h>#include<iostream>using namespace std;int a[101];int key;int low=0,mid,high=100;int count=0;int Search_Bin(){ while(low<high) { mid=(low+high)/2; if(key==a[mid]) return mid; else if(key<a[mid]) high=mid-1;

2020-12-22 19:28:57 72

原创 广度优先搜索

/*@Author : 菜鸟大声笑@Github : https://github.com/cplasf911@Date : 2020-12-13 17:25:21@LastEditors : 菜鸟大声笑@LastEditTime : 2020-12-13 18:05:01@FilePath : /CC++/C++/ds.c@Description :*/#include <stdlib.h>#include <st

2020-12-22 18:56:23 84

原创 实验20

#include<iostream>using namespace std;class Time;ostream & operator <<(ostream &out,const Time &t3);class Time{public: Time(int t=0,int m=0,int s=0):hour(t),minute(m),second(s) {} friend Time operator +(Time &t2); frie

2020-12-21 20:36:28 140 1

原创 实验19

任务1#include<iostream>using namespace std;class Mammal{public: Mammal() { cout << "Mammal" << endl; } ~Mammal() { cout << "~Mammal" << endl; }};class Dog:public Mammal{public: Dog() { cout << "Dog" << en

2020-12-21 18:18:38 117

原创 实验18

任务1#include<iostream>using namespace std;class Object{public: void setweight(double newweight) {weight=newweight;} double showweight() {return weight;} Object(double w):weight(w){cout<<"Object Constr"<<endl;} ~Object(){cout<&l

2020-12-11 17:00:20 80

原创 实验17

任务1#include<iostream>using namespace std;void pass1(){ char str[100]; cin.getline(str, 100); cout << str << endl;}任务2#include<iostream>#include<string>using namespace std;void pass2(){ string s1, s2; cin >&

2020-12-10 19:43:27 73

原创 实验16 任务4

#include <iostream>using namespace std;class Point {public: Point() : x(0), y(0) { cout << "Default Constructor called." << endl; } Point(int x, int y) : x(x), y(y) { cout << "Constructor called." << endl; } ~Poin

2020-12-10 19:15:57 205

原创 二叉树

#include "stdlib.h"#include "stdio.h"#include"conio.h"#define NULL 0typedef struct stu{ char data; struct stu *left,*right;}sn;sn *Create(sn *a){ char ch; scanf("%c",&ch); if(ch=='*') a=NULL; else { a=(sn *)malloc(sizeof(sn)); if (!a)

2020-12-01 20:16:59 71

原创 实验15

任务一#include<iostream>using namespace std;int main(){ double ted=20.2; double *ptr = &ted; cout << "ted=" << ted << endl; cout << "*ptr=" << *ptr << endl; return 0;}

2020-11-27 17:36:21 113

原创 实验14 任务4

#include<iostream>using namespace std;class Point { //类的定义public: //外部接口 int max, min, sum; void get(int NewX, int NewY); int x, y;};void Point::get(int newX, int newY){ x = newX; y = newY;}int main(){ int max, min,sum; Point a[10];

2020-11-22 16:58:34 111

原创 矩阵转置

#include<iostream>using namespace std;int another(){ int num[4][4]; int i, j; for (j = 0;j < 4;j++) { for (i = 0;i < 4;i++) { cin >> num[i][j]; } } int anothernum[4][4]; for (i = 0;i < 4;i++) { for (j = 0;j < 4

2020-11-22 11:05:05 142

原创 实验14 任务1,2

#include<iostream>#include<cmath>using namespace std;double P1();int P2_1();int P2_2();int P2_3();int P2_4();int main(){ P2_4();}double P1(){ int i; double a; double numble[4]; cout<<"请输入数字:"; for(i=0;i<5;i++) { ci

2020-11-21 21:11:30 85

原创 串的功能实现

#include "stdlib.h"#include "stdio.h"#define STRINGMAX 81#define LEN sizeof(struct string)struct string{ int len; char ch[STRINGMAX];};typedef struct string STRING;//--------------------函数声明------------------//void creat(STRING *s);void print(S

2020-11-10 20:34:22 143

原创 n的自增

main.cpp#include<iostream>using namespace std;void fn1();int n;int main(){ n=100; fn1(); cout<<n<<endl; return 0;}fn1.cpp#include<iostream>#include<cmath>using namespace std;extern int n;void fn1(){ n++;}

2020-11-06 17:31:51 85

原创 友元

#include<iostream>using namespace std;class X;class Y{public: int g(X &B);private: static X B;};class X{ friend class Z;public: X(int num=0) { i=num; } friend int h(X &A); friend int Y::g(X &B);private: int i;};cla

2020-11-06 16:53:58 90

原创 车船总重

#include<iostream>using namespace std;class Car;class Boat{ friend class Car;public: friend int getTotalWeight(Boat &weight1,Car &weight2); Boat(int B_weight) { weight1=B_weight; } Boat(Boat& boat1) { weight1=boat1.weight1

2020-11-06 16:36:23 92

原创 猫的数量

#include<iostream>#include<string>using namespace std;class Cat{public: Cat(char name[]) { strcpy(C_name,name); numOfCats++; } Cat(Cat& n) { strcpy(C_name,n.C_name); numOfCats++; } string getNameOfcats() { return C_na

2020-11-05 19:52:34 233

原创 利用栈判断回文

#include<iostream.h>#include<stdlib.h>#include<string.h>//using namespace std;typedef struct StackNode{ int data; struct StackNode *next;}StackNode,*LinkStack;int InitStack(LinkStack &S){ S=NULL; return 1;}int Push(LinkS

2020-11-02 20:34:02 695

原创 进制转化

c#include<iostream.h>#include<stdlib.h>//using namespace std;typedef struct StackNode{ int data; struct StackNode *next;}StackNode,*LinkStack;int InitStack(LinkStack &S){ S=NULL; return 1;}int Push(LinkStack &S, int e){

2020-11-02 19:41:53 86

原创 糖块数据

#include<iostream>#include<iomanip>#include<string>using namespace std;struct CandyBar{ char c_logo[100];//品牌 double c_weight;//重量 int c_calorie;//卡路里};int main(){ CandyBar snack={"MochaMunch",2.3,350}; cout<<"snack's l

2020-10-31 12:22:34 85

原创 银行账户系统

#include#includeusing namespace std;class Account{private:char m_name[10];char m_zh[20];double m_money;public:Account(char name[],char zh[],double money);void show();void add(double money);void get(double money);};Account::Account(char name[

2020-10-30 19:24:59 124

原创 圆的面积

#includeusing namespace std;class Circle{private:double radius;public:Circle(int r);double getArea();};Circle::Circle(int r){radius=r;}double Circle::getArea(){return radiusradius3.1415926;}int main(){Circle cr(2);cout<<“S=”<&

2020-10-30 19:12:28 76

原创 矩形类

#includeusing namespace std;class Rectangle{private:int left_x,left_y;int right_x,right_y;public:Rectangle(int x_1,int y_1,int x_2,int y_2);int Rectangle_S();void output();void outputCenter();};Rectangle::Rectangle(int x_1,int y_1,int x_2,int

2020-10-30 18:49:57 309

原创 股票系统

#include#includeusing namespace std;class Stock{private:char S_name[100];int S_num;double S_price;double S_total_value;public://void acquire(char name[],int num,double price);void buy(int num,double price);void sell(int num,double price);void

2020-10-30 18:48:25 212

空空如也

空空如也

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

TA关注的人

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