Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <fstream>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- //2
- /*
- class guitar {
- private:
- string mod, prod, type, sim_type;
- int raod, price;
- public:
- guitar(string mod, string prod, int raod, string type, string sim_type, int price)
- {
- this->mod = mod;
- this->prod = prod;
- this->raod = raod;
- this->type = type;
- this->sim_type = sim_type;
- this->price = price;
- }
- int get_raod() {
- return raod;
- }
- string get_mod() {
- return mod;
- }
- string get_prod() {
- return prod;
- }
- string get_type() {
- return type;
- }
- string get_sim_type() {
- return sim_type;
- }
- int get_price() {
- return price;
- }
- ~guitar() {
- cout << "program end........";
- }
- };
- int main() {
- string mod, prod, type, sim_type;
- int raod, price;
- ifstream ifs("guitars.txt");
- vector<guitar> guitars;
- while(ifs >> mod >> prod >> sim_type >> raod >> price)
- {
- // guitar(string mod, string prod, int raod, string type, string sim_type, int price)
- guitar x(mod, prod, raod, type, sim_type, price);
- guitars.push_back(x);
- }
- for (int i = 0; i < guitars.size(); ++i) {
- cout << guitars[i].get_prod() << " "
- << guitars[i].get_price() << " "
- << guitars[i].get_mod()<<" "
- << guitars[i].get_raod() <<" "
- << guitars[i].get_sim_type() << endl;
- }
- }
- */
- //3
- /*
- class smartphone {
- private:
- string mod, prod, op_sys, op_sys_type;
- int memory, ram;
- public:
- smartphone(string mod, string prod, int memory, string op_sys, string op_sys_type, int ram)
- {
- this->mod = mod;
- this->prod = prod;
- this->memory = memory;
- this->op_sys = op_sys;
- this->op_sys_type = op_sys_type;
- this->ram = ram;
- }
- int get_memory() {
- return memory;
- }
- string get_mod() {
- return mod;
- }
- string get_prod() {
- return prod;
- }
- string get_op_sys() {
- return op_sys;
- }
- string get_op_sys_type() {
- return op_sys_type;
- }
- int get_ram() {
- return ram;
- }
- ~smartphone() {
- cout << "program end........";
- }
- };
- int main() {
- string mod, prod, op_sys, op_sys_type;
- int memory, ram;
- ifstream ifs("smartphones.txt");
- vector<smartphone> smartphones;
- while(ifs >> mod >> prod >> op_sys_type >> memory >> ram)
- {
- smartphone x(mod, prod, memory, op_sys, op_sys_type, ram);
- smartphones.push_back(x);
- }
- for (int i = 0; i < smartphones.size(); ++i) {
- cout << smartphones[i].get_prod() << " "
- << smartphones[i].get_ram() << " "
- << smartphones[i].get_mod()<<" "
- << smartphones[i].get_memory() <<" "
- << smartphones[i].get_op_sys_type() << endl;
- }
- }
- */
- //4
- /*
- class light {
- private:
- string type;
- int raod, length, d_or_w;
- public:
- light(string type,int raod, int length , int d_or_w)
- {
- this->type = type;
- this->raod = raod;
- this->length = length;
- this->d_or_w=d_or_w;
- }
- int get_d_or_w()
- {
- if (type=="mrgvali")
- {
- cout<<d_or_w;
- }else
- {
- cout<<length<<" "<<d_or_w;
- }
- }
- int get_raod() {
- return raod;
- }
- string get_type() {
- return type;
- }
- int get_length() {
- return length;
- }
- ~light() {
- cout << "program end........";
- }
- };
- int main() {
- string type;
- int raod, length, d_or_w;
- ifstream ifs("lights.txt");
- vector<light> lights;
- while(ifs >> type >> raod >> length >> d_or_w)
- {
- light x(type, raod, length , d_or_w);
- lights.push_back(x);
- }
- for (int i = 0; i < lights.size(); ++i) {
- cout << lights[i].get_length() << " "
- << lights[i].get_type()<<" "
- << lights[i].get_raod() <<" "
- <<lights[i].get_d_or_w()<<endl;
- }
- }
- */
- //5
- /*
- class continent {
- private:
- string name, mosazghvre;
- int fartobi, mos;
- public:
- continent(string name,int fartobi, int mos , string mosazghvre )
- {
- this->name = name;
- this->fartobi = fartobi;
- this->mos = mos;
- this->mosazghvre=mosazghvre;
- }
- int get_fartobi() {
- return fartobi;
- }
- string get_name() {
- return name;
- }
- int get_mos() {
- return mos;
- }
- string get_mosazghvre()
- {
- return mosazghvre;
- }
- ~continent() {
- cout << "program end........";
- }
- };
- bool mysort( continent a, continent b)
- {
- return a.get_fartobi()<b.get_fartobi();
- }
- int main() {
- string name,mosazghvre;
- int fartobi, mos;
- ifstream ifs("continents.txt");
- vector<continent> continents;
- while(ifs >> name >> fartobi >> mos >> mosazghvre)
- {
- continent x(name, fartobi, mos, mosazghvre );
- continents.push_back(x);
- }
- sort(continents.begin(), continents.end(),mysort);
- for (int i = 0; i < continents.size(); ++i) {
- cout << continents[i].get_mos() << " "
- << continents[i].get_name()<<" "
- << continents[i].get_fartobi() <<" "
- <<continents[i].get_mosazghvre()<<" "<<endl;
- }
- }
- */
- //6
- /*
- class planet {
- private:
- string name, system;
- int dashoreba, raod, galaxy;
- public:
- planet(string name,int dashoreba, int raod , string system, int galaxy )
- {
- this->name = name;
- this->dashoreba = dashoreba;
- this->raod = raod;
- this->system=system;
- this->galaxy;
- }
- int get_dashoreba() {
- return dashoreba;
- }
- string get_name() {
- return name;
- }
- int get_raod() {
- return raod;
- }
- string get_system()
- {
- return system;
- }
- int get_galaxy()
- {
- return galaxy;
- }
- ~planet() {
- cout << "program end........";
- }
- };
- bool mysort( planet a, planet b)
- {
- return a.get_dashoreba()<b.get_dashoreba();
- }
- bool sort_raod(planet a, planet b)
- {
- return a.get_raod()<b.get_raod();
- }
- int main() {
- string name, system;
- int dashoreba, raod, galaxy;
- ifstream ifs("planets.txt");
- vector<planet> planets;
- while(ifs >> name >> dashoreba >> raod >> system>>galaxy)
- {
- planet x(name, dashoreba, raod, system ,galaxy);
- planets.push_back(x);
- }
- sort(planets.begin(), planets.end(),mysort);
- sort(planets.begin(), planets.end(),sort_raod);
- for (int i = 0; i < planets.size(); ++i) {
- cout << planets[i].get_raod() << " "
- << planets[i].get_name()<<" "
- << planets[i].get_dashoreba() <<" "
- <<planets[i].get_system()<<" "
- <<planets[i].get_galaxy()<<endl;
- }
- }
- */
- //7
- /*
- class dot {
- private:
- int x, y, z;
- public:
- dot(int x, int y , int z )
- {
- this->x = x;
- this->y = y;
- this->z;
- }
- int get_x() {
- return x;
- }
- int get_y() {
- return y;
- }
- int get_z()
- {
- return z;
- }
- ~dot() {
- cout << "program end........";
- }
- int get_position()
- {
- return sqrt(x*x+y*y+z*z);
- }
- };
- int my_sort(dot a, dot b)
- {
- return a.get_position()>b.get_position();
- }
- int main() {
- int x, y, z;
- vector<dot> dots;
- while(cin>>x >> y >>z)
- {
- dot t( x, y,z);
- dots.push_back(t);
- }
- sort(dots.begin(), dots.end(), my_sort);
- for (int i = 0; i < dots.size(); ++i) {
- //აq ფაილებში გადაანაწილე რა არის ვერ მივხვდი ,ანუ სხვადასხვა ფაილში ჩავწერო თითოეული თუ რა ვარიანტიa? ვაფშე ძაან დებილური ამოცანაა ეს -__-
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement