Вот что у меня получилось...
| Код | /* main.cpp */ #include <iostream> #include "organizations.h"
int main() { // sozdanie obiekta klassa organization Organizations organization;
std::string name; std::string office; std::string index; std::string telephone; std::string fax; std::string schet; std::string bank;
// Vvod znacheniya s klaviaturi std::cout << "Название организации: "; getline(std::cin, name); std::cout << "Адресс(город,ул., дом): "; getline(std::cin, office); std::cout << "Индекс: "; getline(std::cin, index); std::cout << "Телефон: "; getline(std::cin, telephone); std::cout << "Факс: "; getline(std::cin, fax); std::cout << "Р/с: "; getline(std::cin, schet); std::cout << "Название банка: "; getline(std::cin, bank);
// Sohranenie v obiekt klassa Organization organization.set_name(name); organization.set_office(office); organization.set_index(index); organization.set_telephone(telephone); organization.set_fax(fax); organization.set_schet(schet); organization.set_bank(bank);
// Vivod dannih po organizacii std::cout << "Название организации: " << organization.get_name() << std::endl; std::cout << "Почтовый адресс " << organization.get_office() << " Индекс: " << organization.get_index() << std::endl; std::cout << "Телефон: " << organization.get_telephone() << " Факс: " << organization.get_fax() << std::endl; std::cout << "Р/с: " << organization.get_schet() << " Банк: " << organization.get_bank() << std::endl;
system("pause"); return 0; }
|
| Код | #include <string>
class Organizations { public: // name org void set_name(std::string org_name) { name = org_name; } // get name std::string get_name() { return name; } // adress office void set_office(std::string org_office) { office = org_office; } // get office std::string get_office() { return office; } // index void set_index(std::string org_index) { index = org_index; } // get_index std::string get_index() { return index; } // telephone void set_telephone(std::string org_telephone) { telephone = org_telephone; } // get telephone std::string get_telephone() { return telephone; } // fax void set_fax(std::string org_fax) { fax = org_fax; } // get fax std::string get_fax() { return fax; } // p/c void set_schet(std::string org_schet) { schet = org_schet; } // get p/c std::string get_schet() { return schet; } // name bank void set_bank(std::string org_bank) { bank = org_bank; } // get name bank std::string get_bank() { return bank; } private: std::string name; std::string office; std::string index; std::string telephone; std::string fax; std::string schet; std::string bank; };
|
не знаю теперь как сделать чтобы можно было изменять информацию, помогите... может в конце как то типа нажмите 1 чтобы отредактировать информацию нажмите 2 чтобы выйти из программы
создание/уничтожение это конструктор и деструктор? |