сижу уже долго над решением даной задачи, нужно написать функцию сортировки масива models,находил только сортировку цифр либо char(мне нужен string)

#include <string>
#include <algorithm>
using namespace std;

class Phones{
private:

        string model;
        string color;
        int price;
public:
    Phones():model("iphone"),color("red"),price(600){}
    Phones(string model,string color,int price):model(model),color(color),price(price){}

    string getmodel(){
            return model;
        }
    string getcolor(){
        return color;
    }
    int getprice(){
        return price;
    }

        void input(){
            cout << "enter model" << endl << "enter color" << endl << "enter price" << endl;
            cin >> model
            >> color
            >> price;
    }
        void output(){

        cout << "model\t" << model<< "\t" << "color\t" << color << "\t" << "price\t" << price << endl << endl;
    }

        void sort(){
           //здесь нужна функция сортировки


    }

        void smallerprice(){

            string *models = new string[3];
            string *colors = new string[3];
            int *prices = new int[3];
            int b;

            cout << "enter sum" << endl;
            cin>> b;
            for(int t = 0;t < 3 ;t++) {
                if (prices[t] <= b) {
                    cout << prices[t] << " " << colors[t] << endl;
                }
            }
        }
        void returnwhite()
        {
            string *models = new string[3];
            string *colors = new string[3];
            int    *prices = new int[3];

            for (int p = 0; p < 3; p++) {
                if (colors[p] == "white")
                    prices[p] + 100;
                for (int g; g < 10; g++)
                    cout << models[g] << " " << prices[g] << " " << colors[g] << endl;
            }
        }
};
int main() {

    Phones *phon= new Phones[3];
    for(int i = 0;i < 3; i++)
    {
       b[i].input();
    }
    for(int i = 0; i < 3; i++)
    {
        b[i].output();
        b[i].sortuv();
    }



}


Ответы (0 шт):