fork(1) download
  1. /*Создайте класс Date, который будет содержать информацию
  2. о дате (день, месяц, год). С помощью механизма перегрузки
  3. операторов, определите операцию разности двух дат (результат
  4. в виде количества дней между датами), а также операцию
  5. увеличения даты на определенное количество дней. */
  6.  
  7. #include <iostream>
  8. #include <string.h>
  9. #include <Windows.h>
  10. #include <time.h>
  11.  
  12. using namespace std;
  13.  
  14. class DateTime
  15. {
  16. public:
  17.  
  18. static DateTime Parse( String^ s);//проба 1
  19.  
  20. DateTime(int year, int month, int day);//проба 2
  21. //---------------проба 3--------------------------------
  22. static TimeSpan operator -(
  23. DateTime d1,
  24. DateTime d2
  25. )
  26. //--------------------------------------------------------
  27. DateTime (){};//конструктор по умолчанию
  28.  
  29. DateTime (int a, int b, int c)//конструктор
  30. {
  31. iday=a;
  32. imonth=b;
  33. iyear=c;
  34. }
  35.  
  36.  
  37.  
  38. private:
  39. int iday;
  40. int imonth;
  41. int iyear;
  42.  
  43. }D;
  44.  
  45.  
  46.  
  47. void main()
  48. {
  49. SetConsoleCP(1251);
  50. SetConsoleOutputCP(1251);
  51.  
  52. while(true)
  53. {
  54. DateTime d1 (13, 01, 2012);
  55. DateTime d2 (13, 01, 2013);
  56.  
  57. system("pause");
  58. system("cls");
  59. }
  60. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:9:21: error: Windows.h: No such file or directory
prog.cpp:18: error: ‘String’ has not been declared
prog.cpp:18: error: expected ‘,’ or ‘...’ before ‘^’ token
prog.cpp:22: error: ISO C++ forbids declaration of ‘TimeSpan’ with no type
prog.cpp:22: error: expected ‘;’ before ‘operator’
prog.cpp:29: error: ‘DateTime::DateTime(int, int, int)’ cannot be overloaded
prog.cpp:20: error: with ‘DateTime::DateTime(int, int, int)’
prog.cpp:43: error: no matching function for call to ‘DateTime::DateTime()’
prog.cpp:20: note: candidates are: DateTime::DateTime(int, int, int)
prog.cpp:15: note:                 DateTime::DateTime(const DateTime&)
prog.cpp:47: error: ‘::main’ must return ‘int’
prog.cpp: In function ‘int main()’:
prog.cpp:49: error: ‘SetConsoleCP’ was not declared in this scope
prog.cpp:50: error: ‘SetConsoleOutputCP’ was not declared in this scope
prog.cpp:57: error: ‘system’ was not declared in this scope
stdout
Standard output is empty