|
|
Регистрация Восстановить пароль |
Повторная активизация e-mail |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
|
Опции темы | Поиск в этой теме |
10.01.2013, 22:33 | #1 |
Новичок
Джуниор
Регистрация: 13.01.2012
Сообщений: 2
|
Переделать пргограмму в MFC
int const N = 5;
using namespace std; class book{ public: book(); string getAuthor() const; void setAuthor(string); string getName() const; void setName(string); int getPages() const; void setPages(int); bool getIsFree() const; void setNewBook(); void printBook(); private: bool isFree; string author; string name; int pages; }; void sortBooks(class book* arr){ string str1; string str2; for(int i = 0 ; i < N ; i++) for(int j = i ; j < N ; j++) if (arr[i].getName() >= arr[j].getName()) std::swap(arr[i],arr[j]); } book::book(){ isFree = true; } void book::setNewBook(){ cout<<endl<<"Enter author: "; cin>>author; cout<<endl<<"Enter name: "; cin>>name; cout<<endl<<"Enter number of pages: "; cin>>pages; isFree = false; } void book::setAuthor(string newAuthor){ author = newAuthor; } void book::setName(string newName){ name = newName; } void book::setPages(int newPages){ pages = newPages; } bool book::getIsFree() const{ return isFree; } string book::getAuthor() const{ return author; } string book::getName() const{ return name; } int book::getPages() const{ return pages; } void book:rintBook(){ cout<<"\n Author: "<<author <<"\n Name: "<<name <<"\n Pages: "<<pages; } int main() { bool isInMenu = true; char key; class book arr[N]; int i = 0; while(isInMenu){ cout<<"1 to create new book \n" <<"2 to sort books \n" <<"3 to print all books \n" <<"4 to exit \n" <<"Choise: "; cin>>key; switch(key){ case '1': if (i==N) { cout<<"\n There is no empty slots left! \n"; break; } arr[i].setNewBook(); i++; break; case '2': sortBooks(arr); break; case '3': for(int i = 0; i<N; i++) if(!arr[i].getIsFree()) arr[i].printBook(); break; case '4': isInMenu = false; break; } //key=0; cout<<"\n\n\n\n"; } getchar(); } На вход подается некоторое количество описаний книг (автор, название, количество страниц). Отсортировать и вывести в алфавитном порядке по названиям. Нужно сделать в графическом режиме. Без всяких излишеств, очень просто. Помогите пожалуйста, за один вечер не осилю |
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Drag&Drop NO MFC! NO MFC! | Антоним | Win Api | 1 | 12.11.2012 21:43 |
Различие кода mfc и WinApi(mfc ручками набили, а WinApi автоматически с генерировался!! нужно явное отличие, не могу найти) | Артём1991 | Помощь студентам | 0 | 25.03.2012 17:13 |
MFC | sir.andrey | Обсуждение статей | 0 | 21.08.2011 14:11 |
MFC | volcka | Помощь студентам | 0 | 13.05.2011 11:26 |
MFC | Diman2008 | Visual C++ | 2 | 06.03.2008 16:24 |