Re[12]: нуждаюсь в помощи, помогите, пожалуйста
От: Vamp Россия  
Дата: 01.04.05 14:19
Оценка:
#include <iostream>
#include <string>

using namespace std;

#pragma hdrstop
#pragma argsused
//---------------------------------------------------------------------------
class Katalog
{
  int i,sz;
  int* name_book;
  int* name_autor;
  int* summ_books;
 public:
   Katalog()
   {
      i = 0;
      sz = 10000;
      name_book = new int[sz];
      name_autor = new int[sz];
      summ_books = new int[sz];
   }
   void Katalog::new_book()
   {
       cout << "Enter new book data:" << endl;
       std::cin>>name_book[i];
       std::cin>>name_autor[i];
       std::cin>>summ_books[i];
       ++i;
   }
   void  Katalog::console_books()
   {
       for(int b=0; b<i;b++)
       {
           std::cout<<"Êíèãà: "<<name_book[b]<<" Àâòîð: "<<name_autor[b]<<" Êîëè÷åñòâî ýêçåìïëÿðîâ:"<<summ_books[b] << endl;
       }
   }
};

int main(int argc, char* argv[])
{
 Katalog*     kat = new Katalog();
 string input;
 cout << "New command?" << endl;
 cin >> input;
 while ( input != "exit") {
    if(input=="Help")
    {
        cout << "Simple help message." << endl;
    }
    else if(input=="New")
    {
    kat-> new_book();
    }
    else if(input=="Window")
    {
     kat->console_books();
    }
    else
    {
     std::cout<<"Error: " << input << " unrecognized!" << endl;
    }
    cout << "New command?" << endl;
    cin >> input;

 }
}
Да здравствует мыло душистое и веревка пушистая.
Re[13]: нуждаюсь в помощи, помогите, пожалуйста
От: GarryIV  
Дата: 01.04.05 14:58
Оценка:
Hello, Vamp!


V>
 V> class Katalog
 V> {
 V>   int* name_book;
 V>   int* name_autor;
 
 V> int main(int argc, char* argv[])
 V> {
 V>  Katalog*     kat = new Katalog();
  V> }
 V>


ура! почти все ошибки исправили
осталось только не забыть каталог удалить (и зачем его указателем сделали? ). ну еще name_book и name_author почему то стали int хотя сначало было string, но это уже мелочи.
Posted via RSDN NNTP Server 1.9
WBR, Igor Evgrafov
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.