divyang4481 / mipt-hw

Automatically exported from code.google.com/p/mipt-hw
0 stars 0 forks source link

task06 TDateTime (Яковенко) #231

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Здесь необходимо указать путь к папке с
решенным заданием.
Например:
/ayvazyan_yuliy/task01_vector/

А также Ваши комментарии (если нужно).

Original issue reported on code.google.com by iakovenk...@gmail.com on 2 May 2013 at 6:37

GoogleCodeExporter commented 9 years ago
1. Принято cpp/h файлы называть одинаково. 
Например:
TDateTime.h/TDateTime.cpp. Тогда понятно, что в *.h лежит 
интерфейс, а в соответствующем *.cpp - 
реализация.

2. Пишу в main() следующий код:
        TDateTime dt = TDateTime::Now();
        cout << dt << endl << endl;

        TTimeSpan ts(1, 1, 1);
        cout << (dt + ts) << endl << endl;
        dt = dt + ts;
        cout << dt << endl << endl;
        dt -= ts;
        cout << dt << endl << endl;

Пробую компилировать. Получаю:
main.cpp: In function ‘int main()’:
main.cpp:119: error: no match for ‘operator=’ in ‘dt = dt. 
TDateTime::operator+(((const TTimeSpan&)((const TTimeSpan*)(& ts))))’
my_time.h:69: note: candidates are: TDateTime& TDateTime::operator=(TDateTime&)
main.cpp:121: error: no match for ‘operator-=’ in ‘dt -= ts’

Решение не принято.

Original comment by aivyu...@gmail.com on 10 May 2013 at 11:13

GoogleCodeExporter commented 9 years ago

Original comment by iakovenk...@gmail.com on 21 May 2013 at 10:48

GoogleCodeExporter commented 9 years ago
Решение принято.

Original comment by aivyu...@gmail.com on 26 May 2013 at 12:05