Классы, их инициализация с помощью конструктора и инициализатора, перегрузка, страница 13

            this->new_accession(atoi(buffer[3]));

            this->new_group(buffer[4]);

            this->new_marks(mark,0);

            return fin;

}

istream& student::operator >> (istream& fin)

{

            char* buffer[6];

            int* mark;

            int size;

            for (int i=0; i<6; i++)

            {

                        if ((i!=3)&&(i!=4)) buffer[i] = new char [30];

                        else buffer[i] = new char [6];

                        switch (i)

                        {

                        case 0: cout<<"Enter surname: "; break;

                        case 1: cout<<"Enter name: "; break;

                        case 2: cout<<"Enter second name: "; break;

                        case 3: cout<<"Enter year of accession: "; break;

                        case 4: cout<<"Enter academical group: "; break;

                        case 5: cout<<"Enter marks: ";

                                                break;

                        }

                        //fin.getline(buffer[i],size_info(buffer[i]),'\n');

                        fin>>buffer[i];

            }

            size=size_info(buffer[5]);

            buffer[5][size]='0';

            size++;

            buffer[5][size]='\0';

            mark = new int [size];

            for (i=0; i<size; i++)

                        mark[i] = (int)buffer[5][i]-(int)'0';

            this->new_surname(buffer[0],0);

            this->new_name(buffer[1],0);

            this->new_sec_name(buffer[2]);

            this->new_accession(atoi(buffer[3]));

            this->new_group(buffer[4]);

            this->new_marks(mark,0);

            return fin;

}

ostream& student::operator << (ostream& fout)

{

            fout<<"Surname:     "<<this->surname<<endl;