Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<string>
- #include<iostream>
- #include<algorithm>
- using namespace std;
- class Bike {
- private:
- string manufacturer;
- string model;
- string size;
- string gender;
- static int count;
- public:
- Bike(){
- ++count;
- }
- Bike(string manufacturer,string model,string size,string gender ) {
- this->manufacturer = manufacturer;
- this->model = model;
- this->size = size;
- this->gender = gender;
- ++count;
- }
- void setManufacturer(string manufacturer) {
- this->manufacturer = manufacturer;
- }
- void setModel(string model) {
- this->model = model;
- }
- void setSize(string size) {
- this->size = size;
- }
- void setGender(string gender) {
- this->gender = gender;
- }
- void getManufacturer() {
- cout << "Производитель: " << manufacturer << endl;
- }
- void getModel() {
- cout << "Модель: " << model << endl;
- }
- void getSize() {
- cout << "Размер: " << size << endl;
- }
- void getGender() {
- cout << "Пол: " << gender << endl;
- }
- void getCount() {
- cout << "Колличество: " << count << endl;
- }
- bool operator<(Bike a) {
- if ((size == "s"&& a.size == "m") || (size == "s"&& a.size == "l") || (size == "s"&& a.size == "xl")) {
- return 1;
- }
- else {
- if ((size == "m"&& a.size == "l") || (size == "m"&& a.size == "xl")) {
- return 1;
- }
- else {
- if (size == "l"&& a.size == "xl") {
- return 1;
- }
- }
- }
- if (size == a.size) {
- if (manufacturer == a.manufacturer) {
- return(model < a.model);
- }
- else {
- return(manufacturer < a.manufacturer);
- }
- }
- }
- };
- int Bike::count = 0;
- int main() {
- setlocale(LC_ALL, "russian");
- Bike stels("China","GF102","m","Male");
- Bike stinger("China","XZ22C","m","Female");
- Bike electra;
- electra.setManufacturer("Russia");
- electra.setModel("FS23");
- electra.setSize("xl");
- electra.setGender("Male");
- cout << "Stels:" << endl;
- stels.getManufacturer();
- stels.getModel();
- stels.getSize();
- stels.getGender();
- cout << "Stinger" << endl;
- stinger.getManufacturer();
- stinger.getModel();
- stinger.getSize();
- stinger.getGender();
- cout << "Electra" << endl;
- electra.getManufacturer();
- electra.getModel();
- electra.getSize();
- electra.getGender();
- cout << "Stels < Stinger ?" << endl;
- if (stels < stinger) {
- cout << "ДА"<<endl;
- }
- else {
- cout << "НЕТ"<<endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement