虚幻Unreal - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(50评价)
价格: 2079.00元
  • Set Timer By Function Name
  • Clear Timer By Function Name
[展开全文]
yanpengit · 24天前 · 0

这里的判断重复了,如果Amount>1成立,那么CanBeStack必然成立。但是CanBeStack成立,Amount>1未必成立。

所以,最后一个CanBeStack

[展开全文]
cto_jo · 07-14 · 0

SearchEmptySlot函数可以精简一下:

[展开全文]
cto_jo · 07-02 · 0

cout << "请输入数字,结束请输入0" << endl;
    float a ;
    cin >> a;
    float total = 0;
    for (; a != 0;) {
        total += a;
        cout <<"当前结果"<< total << endl;
        cout << "请输入数字,结束请输入0" << endl;
        cin >> a;
    } //不用判断语句也是完成该题目的。。。

[展开全文]
浅唱忧伤0902 · 06-26 · 0

访问控制

级别:public < protected < private

类的继承方式和内部的成员,取级别高的

[展开全文]
黄俊豪 · 06-23 · 0

概念:

1.重载:在同一作用域下,函数名相同,但参数列表不同。

2.重写:分别在基类和派生类中(在不同的作用域下),函数名相同,参数相同,返回类型相同,并且基类函数必须为虚函数。

3.重定义:分别在基类和派生类中(在不同作用域下),函数名相同,不不构成重写的话则为重定义。(参数列表可相同可不同)。

[展开全文]
史小墙 · 06-20 · 0

完成程序:职业系统

要求:

1.设计一个包含所有职业共同属性和方法的基类(HP,MP,DEF,RES,普通攻击)

2.设计合集三个不同的派生类(Warrior,Mage,Priest),各个派生类特有的属性(战士:ATN,法师,牧师:INT)不同职业拥有各自不同的技能

(战士:刀斩,法师:火球术,牧师:治疗术)

3.创建各个对象并使用技能。

 

 

 

[展开全文]
史小墙 · 06-18 · 0
#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
class B
{
public:
	int b_;
	B(int b = 0)
	{
		b_ = b;
		cout << "调用B的构造函数" << endl;
	}
};
class C1 :virtual public B
{
public:
	int c1_;
	C1(int b = 0, int c1 = 0) :B(b)
	{
		c1_ = c1;
		cout << "调用C1的构造函数" << endl;
	}
};
class C2 :virtual public B
{
public:
	int c2_;
	C2(int b = 0, int c2 = 0) :B(b)
	{
		c2_ = c2;
		cout << "调用C2的构造函数" << endl;
	}
};
class D :public C1, public C2
{
public:
	int d_;
	D(int b = 0, int c1 = 0, int c2 = 0, int d = 0) :B(b), C1(b, c1), C2(b, c2)
	{
		d_ = d;
		cout << "调D的构造函数" << endl;
	}
	void printf()
	{
		cout << "  C1.b_: " << C1::b_ << "  C2.b_: " << C2::b_ << "  c1_: " << c1_ << "  c2_: " << c2_ << "  d_: " << d_ << endl;
	}
};
class D2 : public C1, public C2
{
public:
	int d2_;
	D2(int b = 0, int c1 = 0, int c2 = 0, int d2 = 0) :B(b), C1(b, c1), C2(b, c2)
	{
		d2_ = d2;
		cout << "调用D2的构造函数" << endl;
	}
	void printf()
	{
		cout << "b_: " << b_ << "  c1_: " << c1_ << "  c2_: " << c2_ << "  d_: " << d2_ << endl;
	}
};
int main()
{
	D d = D(1, 2, 3, 4);
	d.printf();
	D2 d2 = D2(3, 4, 5, 6);
	d2.printf();


}

 

[展开全文]
史小墙 · 06-18 · 0
#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
class Student 
{
protected:
	string name_;
	int age_;
public:
	void setStudent(string name, int age)
	{
		name_ = name;
		age_ = age;
	}
	void printf()
	{
		cout << "姓名: " << name_ << "  年龄: " << age_ << endl;
	}
	int get_age()
	{
		return age_;
	}
	string get_name()
	{
		return name_;
	}
};
class Collagestudent:public Student 
{
private:
	string major_;
public:
	void setCStudent(string name, int age, string major)
	{
		name_ = name;
		age_ = age;
		major_ = major;
	}
	void printf()
	{
		cout << "姓名: " << name_ << "  年龄: " << age_ << "  专业: "<<major_<<endl;
	}
};
void work(Student &s)
{
	if (s.get_age() >=18)
		cout <<s.get_name()<< "达到法定工作年龄" << endl;
	else
		cout << s.get_name() << "未达到法定工作年龄" << endl;
}

int main()
{
	Student stu;
	stu.setStudent("李明",15);
	stu.printf();
	Collagestudent cstu;
	cstu.setCStudent("李雷", 18, "计算机");
	cstu.printf();
	Student stu1 = cstu;//将派生类对象赋值给基类对象
	stu1.printf();
	Student& rs = cstu;//将派生类的对象初始化基类的引用
	rs.printf();
	Student* ps = &cstu;//可以将派生类对象的地址赋给基类指针
	ps->printf();
	work(stu);//使用基类对象作为形参
	work(cstu);//使用派生类对象作为形参

}

 

[展开全文]
史小墙 · 06-17 · 0
#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
class Base
{
private:
    int bnum1_;
public://在类的内部都可以访问到,通过成员方法或者友元函数。
    //在派生类中只能访问到基类的public成员和protected成员。
    int bnum2_;
    void setNum(int bnum1, int bnum2, int bnum3)
    {
        bnum1_ = bnum1;
        bnum2_ = bnum2;
        bnum3_ = bnum3;
    }
    friend  void printf(Base &b)
    {
        cout << "  bnum1: " << b.bnum1_ << "  bnum2: " << b.bnum2_ << "  bnum3: " << b.bnum3_ << endl;
    }
protected:
    int bnum3_;
};
class Derived1 :private Base
{
public:
    void printf()
    {
        //基类私有成员不能被访问。
        cout << "bnum2: " << bnum2_ << "  bnum3: " << bnum3_ << endl;
    }
};
class Derived2 :protected Base
{
    void printf()
    {
        //基类私有成员不能被访问。
        cout << "bnum2: " << bnum2_ << "  bnum3: " << bnum3_ << endl;//基类的公有成员和保护成员,在派生类中可以访问。
    }
};
class Derived : public Base
{
private:
    int bnum1_;
public:
    int bnum2_;
protected:
    int bnum3_;
};

int main()
{
    Base b;
    b.bnum2_=10;
    //b.bnum1_=10;//不可以访问
    //b.bnum3_=10;//不可以访问
    b.setNum(20, 25, 30);
    printf(b);
    Derived d;
    d.bnum2_ = 10;//可以被访问
    
}

 

[展开全文]
史小墙 · 06-17 · 0

实现一个Money类

要求:

1.Money类有两个数据成员:金币数量和银币数量,每一个金币等于1000个银币。

2.实现+,-,*,/。

3.实现++,--运算符的重载(银币加减100)。

4.实现=运算符的重载。

5.实现==,!=,>=,<=,<,>运算符的重载。

6.实现>>,<<运算符的重载。

#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
class Money
{
private:
	float gold_;
	float silver_;
	static const int ratio = 1000;
public:
	Money(int gold = 0, int silver = 0);
	~Money();
	Money operator+(const Money& m);
	Money operator-(const Money& m);
	Money operator*(const int n);
	Money operator/(const int n);
	Money& operator++();
	Money& operator--();
	Money& operator=(const Money& m);
	bool operator==(const Money& m);
	bool operator!=(const Money& m);
	bool operator>=(const Money& m);
	bool operator<=(const Money& m);
	bool operator<(const Money& m);
	bool operator>(const Money& m);
	friend ostream& operator<<(ostream& os, const Money& m);
	friend istream& operator>>(istream& is, Money& m);



};

int main()
{
	Money m1 = Money(100, 600);
	Money m2 = Money(100, 500);
	Money m3 = m1;
	Money m4 = m3 + m2;
	Money m5 = m1 * 2;
	++m3;
	Money m6 = m5 / 2;
	cout << m1 << endl << m2 << endl << m3 << endl << m4 << endl << m5 << endl << m6 << endl;
	Money m7;
	cout << "请输入m7的值: ";
	cin >> m7;
	Money m8;
	cout << "请输入m8的值: ";
	cin >> m8;
	if (m7 == m8)
		cout << "m7等于m8" << endl;
	else if (m7 > m8)
	{
		cout << "m7大于m8" << endl;
	}



}

Money::Money(int gold, int silver)
{
	gold_ = gold;
	silver_ = silver;
}

Money::~Money() {}

Money Money::operator+(const Money& m)
{
	Money money;
	int i = this->gold_ * ratio + m.gold_ * ratio + this->silver_ + m.silver_;
	money.gold_ = i / ratio;
	money.silver_ = i % ratio;
	return money;
}

Money Money::operator-(const Money& m)
{
	Money money;
	int i = this->gold_ * ratio - m.gold_ * ratio + this->silver_ - m.silver_;
	money.gold_ = i / ratio;
	money.silver_ = i % ratio;
	return money;
}

Money Money::operator*(const int n)
{
	Money money;
	int i = this->gold_ * ratio * n + this->silver_ * n;
	money.gold_ = i / ratio;
	money.silver_ = i % ratio;
	return money;
}

Money Money::operator/(const int n)
{
	Money money;
	int i = (this->gold_ * ratio + this->silver_) / n;
	money.gold_ = i / ratio;
	money.silver_ = i % ratio;
	return money;
}

Money& Money::operator++()
{
	int i = this->gold_ * ratio + this->silver_;
	i += 100;
	this->gold_ = i / ratio;
	this->silver_ = i % ratio;
	return*this;
}

Money& Money::operator--()
{
	int i = this->gold_ * ratio + this->silver_;
	i -= 100;
	this->gold_ = i / ratio;
	this->silver_ = i % ratio;
	return*this;
}

Money& Money::operator=(const Money& m)
{
	this->gold_ = m.gold_;
	this->silver_ = m.silver_;
	return *this;
}

bool Money::operator==(const Money& m)
{
	if ((this->gold_ * ratio + this->silver_) == (m.gold_ * ratio + m.silver_))
		return true;
	else
		return false;
}

bool Money::operator!=(const Money& m)
{
	if ((this->gold_ * ratio + this->silver_) != (m.gold_ * ratio + m.silver_))
		return true;
	else
		return false;
}

bool Money::operator>=(const Money& m)
{
	if ((this->gold_ * ratio + this->silver_) >= (m.gold_ * ratio + m.silver_))
		return true;
	else
		return false;
}

bool Money::operator<=(const Money& m)
{
	if ((this->gold_ * ratio + this->silver_) <= (m.gold_ * ratio + m.silver_))
		return true;
	else
		return false;
}

bool Money::operator<(const Money& m)
{
	if ((this->gold_ * ratio + this->silver_) < (m.gold_ * ratio + m.silver_))
		return true;
	else
		return false;
}

bool Money::operator>(const Money& m)
{
	if ((this->gold_ * ratio + this->silver_) > (m.gold_ * ratio + m.silver_))
		return true;
	else
		return false;
}

ostream& operator<<(ostream& os, const Money& m)
{
	os << "金币数量:" << m.gold_ << "  " << "银币数量:" << m.silver_ << endl;
	return os;

}

istream& operator>>(istream& is, Money& m)
{
	is >> m.gold_ >> m.silver_;
	if (!is)
	{
		m = Money();
	}
	return is;


}

 

[展开全文]
史小墙 · 06-16 · 0
#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
class Time
{
private:
	int hours_;
	int minutes_;
public:
	Time(int hours = 0, int minutes = 0);
	~Time();
	void showTime();
	Time operator+(const Time& t);
	Time operator-(const Time& t);
	Time operator*(int const i);
};

int main()
{
	Time t1 = Time(19, 55);
	Time t2 = Time(1, 5);
	Time t3 = Time(5, 30);
	//t1.showTime();
	Time total1 = t1 + t2;
	Time total2 = t1.operator-(t3);
	Time total3 = t3.operator*(2);
	Time total4 = t1 + t3 * 2;
	total1.showTime();
	total2.showTime();
	total3.showTime();
	total4.showTime();
}

Time::Time(int hours, int minutes)
{
	hours_ = hours;
	minutes_ = minutes;
}

Time::~Time() {}

void Time::showTime()
{
	cout << "当前时间为:" << hours_ << "小时" << minutes_ << "分" << endl;
}

Time Time::operator+(const Time& t)
{
	Time Temp;
	Temp.hours_ = this->hours_ + t.hours_;
	if (this->minutes_ + t.minutes_ < 60)
		Temp.minutes_ = this->minutes_ + t.minutes_;
	else
	{
		Temp.hours_ += 1;
		Temp.minutes_ += (this->minutes_ + t.minutes_) % 60;
	}

	return Temp;

}

Time Time::operator-(const Time& t)
{
	Time Temp;
	float i = this->hours_ * 60 + this->minutes_ - t.hours_ * 60 - t.minutes_;
	Temp.hours_ = i / 60;
	Temp.minutes_ = i - Temp.hours_ * 60;
	return Temp;
}

Time Time::operator*(int const i)
{
	int j;
	Time temp;
	j = this->hours_ * i * 60 + this->minutes_ * i;
	temp.hours_ = j / 60;
	temp.minutes_ = j - temp.hours_ * 60;
	return temp;

}

 

[展开全文]
史小墙 · 06-14 · 0

药品物资管理

要求:

1.创建药品类来完成习题四中对药品相关的管理。

2.利用对象数组来完成对不同种类药品信息的存储。

3.使用this*指针。

4.使用作用域为类的常量。

Medicines.h

#pragma once
#pragma once
#define MEDICINES_H_
#include "string"
using namespace std;
enum kind { hp, mp };

class Medicines
{
private:
	string name_;
	kind kin_;
	int number_;
	float buy_;
	float sell_;
	static const int Price = 100;
public:
	Medicines(string name, kind kin, int number);
	float Buyin(Medicines& m, float res);
	float Sellout(Medicines& m, float res);
	void display(Medicines m);
	void show(kind k);
};

Medicines.cpp

#include "Medicines.h"
#include <iostream>
#include "stdio.h"
#include "string"
Medicines::Medicines(string name, kind kin, int number)
{
	name_ = name;
	kin_ = kin;
	number_ = number;
	buy_ = Price;
	sell_ = Price * (3.0 / 4);
}

float Medicines::Buyin(Medicines& m, float res)
{
	int i;
	int j = res;
	cout << "请输入购买数量:";
	cin >> i;
	if (j > i * this->buy_)
	{
		this->number_ += i;
		j -= i * this->buy_;
		cout << "购买了" << i << "瓶";
		show(this->kin_);
		cout << "药水" << endl;
	}
	else
		cout << "金钱不足" << endl;
	return j;
}

float Medicines::Sellout(Medicines& m, float res)
{
	int i;
	int j = res;
	cout << "请输入卖出数量:";
	cin >> i;
	if (i < this->number_)
	{
		this->number_ -= i;
		j += i * this->sell_;
		cout << "卖出了" << i << "瓶";
		show(this->kin_);
		cout << "药水" << endl;
	}
	else
		cout << "数量不足" << endl;
	return j;
}

void Medicines::display(Medicines m)
{
	cout << "名称:" << m.name_ << "  " << "种类:";
	show(m.kin_);
	cout << "  " << "数量:" << m.number_ << "  " << "购买价格" << m.buy_ << "  " << "出售价格" << m.sell_ << endl;

}

void Medicines::show(kind k)
{
	if (k == 0)
		cout << "hp ";
	else
		cout << "mp ";
}

主程序

#include <iostream>
#include "stdio.h"
#include "string"
#include "Medicines.h"
using namespace std;
int main()
{
	int select;
	float res = 1000;
	Medicines ms[2] = { { "hp药水",kind(0),5} ,{ "mp药水",kind(1),5} };
	do {
		cout << "请输入对应指令" << endl << "1.购买hp药 2.卖出hp药 3.购买mp药 4.卖出mp药 5.显示背包 6.退出" << endl;
		cin >> select;
		switch (select)
		{
		case 1:
			res = ms[0].Buyin(ms[0],res);
			break;
		case 2:
			res = ms[0].Sellout(ms[0], res);
			break;
		case 3:
			res = ms[1].Buyin(ms[1], res);
			break;
		case 4:
			res = ms[1].Sellout(ms[1], res);
			break;
		case 5:
		{
			ms[0].display(ms[0]);
			ms[1].display(ms[1]);
			cout << "剩余金钱为:" << res << endl;
		}
		break;
		case 6:
			break;
		default:
			break;
		}
	} while (select != 6);


}

 

[展开全文]
史小墙 · 06-12 · 0

完成程序:药品物资管理

要求:1.利用结构体来存储目前用用的药物的名称,种类,数量,买入价格,卖出价格。

2.利用枚举来设置药物的种类(回复mp和回复hp)。

3.编写函数来控制药物的买入和卖出,卖出价格为买入价格的3/4。

4.编写函数来显示拥有的药物和剩余钱数。

5.通过输入数字来控制函数调用。

6.实现分离式编译。

头文件game.h

#pragma once
#ifndef GAME_H_
#define GAME_H_
#include "string"
using namespace std;
enum kind {hp,mp};
struct Bag
{
	string name;
	kind kin;
	int number;
	float buy;
	float sell;
};
int Buyin(Bag &b1,float res);
int Sellout(Bag &b1,float res);
void Display(Bag b1,int i);


#endif // !GAME_H_



game.cpp

#include <iostream>
#include "stdio.h"
#include "string"
#include "game.h"
int Buyin(Bag &b1, float res)
{
	float i = res;
	if (i < b1.buy)
	{
		cout << "金钱不足" << endl;
	}
	else
	{
		b1.number += 1;
		i -= b1.buy;
		cout << "购买一瓶药" << endl;
	}
	return i;
}
int Sellout(Bag &b1, float res)
{
	int i = res;
	if (b1.number< 0)
	{
		cout << "数量不足" << endl;
	}
	else
	{
		b1.number -= 1;
		i+= b1.sell;
		cout << "卖出一瓶药" << endl;
	}
	return i;
}
void Display(Bag b1,int i)
{
	if(i==0)
	cout << "名称:" << b1.name << "  " << "种类:" << "hp" << "  " << "数量:" << b1.number << "  " << "购买价格" << b1.buy << "  " << "出售价格" << b1.sell<<endl;
	else
	cout << "名称:" << b1.name << "  " << "种类:" << "mp" << "  " << "数量:" << b1.number << "  " << "购买价格" << b1.buy << "  " << "出售价格" << b1.sell << endl;

}

主文件

#include <iostream>
#include "stdio.h"
#include "string"
#include "game.h"
using namespace std;
int main()
{
	int select;
	float res = 1000;
	Bag bagh{ "hp药水",kind(0),5,100,75 };
	Bag bagm{ "mp药水",kind(1),5,100,75 };
	do {
		cout << "请输入对应指令" << endl << "1.购买hp药 2.卖出hp药 3.购买mp药 4.卖出mp药 5.显示背包 6.退出" << endl;
		cin >> select;
		switch (select)
		{
		case 1:
			res=Buyin(bagh, res);
			break;
		case 2:
			res = Sellout(bagh, res);
			break;
		case 3:
			res = Buyin(bagh, res);
			break;
		case 4:
			res = Sellout(bagm, res);
			break;
		case 5:
		{
			Display(bagh, bagh.kin);
			Display(bagm, bagm.kin);
			cout << "剩余金钱为:" << res << endl;
		}
		break;
		case 6:
			break;
		default:
			break;
		}
	}
	while (select != 6);


}

 

[展开全文]
史小墙 · 06-11 · 0

完成程序:设计分数显示

要求:

1.要求用户输入最多是个涉及分数,并且将他们存储在一个数组中。

2.输入负数提前完成输入。

3.使用三个数组处理函数分别进行输入,显示和计算平均分数的操作。


#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
void print(int arr[], int size);
int Sr(int arr[], int size=10);
void pj(int arr[], int size);

int main()
{
	int arr[10];
	int size= Sr(arr);
	print(arr, size);
	pj(arr, size);
}
int Sr(int arr[], int size)
{
	int i = 0;
	cout << "请输入10次的成绩" << endl;
	while (cin >> arr[i] && arr[i] >= 0)
	{
		i++;
		if (i == 10)
			break;
	}
	return i;
}
void print(int arr[], int size)
{
	for (int i = 0; i <size; i++)
	{
		cout << "第" << i+1 << "次成绩为" << arr[i] << endl;
	}
}
void pj(int arr[],int size)
{
	float sum = 0;
	for (int i = 0; i < size; i++)
	{
		sum += arr[i];
	}
	cout << "成绩平均值为" << sum / size << endl;


}

 

[展开全文]
史小墙 · 06-09 · 0

习题改

#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
float pj(float i, float j);
int main()
{
	float a, b, temp;
	cout << "请输入两个数的值" << endl;
	while (cin >> a >> b && a != 0 && b != 0)
	{

		cout << a << "和" << b << "的" << "调和平均数为" << pj(a, b) << endl;
		cout << "请输入两个数的值" << endl;

	}

}
float pj(float i, float j)
{
	float sum = 1 / ((1 / i + 1 / j) / 2);
	return sum;
}

 

[展开全文]
史小墙 · 06-09 · 0

练习:求两个数的调和平均数

要求:

1.不断要求用户输入两个数,知道其中一个数的值为0;

2.对于每两个数,程序将使用一个函数来计算他们的调和平均数。

3.函数将计算结果放会给主函数,在主函数中输出输出输入的数字和他们的调和平均数。

4.调和平均数是指倒数平均值的倒数。

#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
float pj(float i, float j);
int main()
{
	float a, b, temp;
	do
	{
		cout << "	请输入a的值" << endl;
		cin >> a;
		cout << "	请输入b的值" << endl;
		cin >> b;
		temp = pj(a, b);
		cout << "a= " << a << endl << "b= " << b << endl << "调和平均值= " << temp << endl;
	} while (a != 0 && b != 0);
}
float pj(float i, float j)
{
	float sum = 1 / ((1 / i + 1 / j)/2);
	return sum;
}

 

[展开全文]
史小墙 · 06-09 · 0

判断是否回文字符串练习题

#include "pch.h"
#include <iostream>
#include "stdio.h"
#include "string"
using namespace std;
int main()
{
	string str;
	cin >> str;
	for (int i = 0; i < str.size() / 2; i++)
	{
		if (str[i] != str[str.size() - 1 - i])
		{
			cout << "不是回文字符串" << endl;
			return false;
		}

	}
	cout << "是回文字符串" << endl;

}

 

[展开全文]
史小墙 · 05-30 · 0

1.用switvh改写下面的代码段

if(ch=='A')
 a_grade++;
else if(ch=='B')
 b_grade++;
else if(ch=='C')
 c_grade++;
else if(ch=='D')
 d_grade++;
else 
 f_grade++;

答:

switch(ch)

{

case ‘A’: a_grade++;

   break;

case ‘B’: b_grade++;

   break;

case ‘C’: c_grade++;

   break;

case ‘D’: d_grade++;

   break;

default: f_grade++;

   break;

}

2.求得20!

#include "pch.h"
#include <iostream>
#include "stdio.h"
using namespace std;
int main()
{
	long long s=1;
	for (int i = 1; i <= 20; i++)
		s *= i;
	cout << "20!=" << s << endl;
	return 0;

}

3.求得1!+2!+3!+...+20!

#include "pch.h"
#include <iostream>
#include "stdio.h"
using namespace std;
int main()
{
	long long s=1,a=0;
	for (int i = 1; i <= 20; i++) {
		s *= i;
		a += s;

	}
	cout << "1!+2!+3!+...+20!=" << a << endl;
	return 0;

}

4.实现函数判断一字符串是否是回文。若是回文,函数返回值为1,否则返回值0。

5.输入三个整数分别放在变量a,b,c中,然后把输入的数据从小到大顺序放到变量a,b,c中,最后输出a,b,c的值。

#include "pch.h"
#include <iostream>
#include "stdio.h"
using namespace std;
int main()
{
	int a, b, c, m;
	cout << "请输入第一个值" << endl;
	cin >> a;
	cout << "请输入第二个值" << endl;
	cin >> b;
	cout << "请输入第三个值" << endl;
	cin >> c;
	if (a > b)
	{
		m = a; a = b; b = m;
	}
	if (a > c)
	{
		m = a; a = c; c = m;
	}
	if (b > c)
	{
		m = b; b = c; c = m;
	}
	cout << "a=" << a << endl;
	cout << "b=" << b << endl;
	cout << "c=" << c << endl;
	return 0;



}

  

[展开全文]
史小墙 · 05-30 · 0