fork 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 Cdate
  15. {
  16. public:
  17.  
  18. static DateTime Parse( String^ s);//проба 1
  19.  
  20. DateTime(int year, int month, int day);//проба 2
  21.  
  22. Cdate (){};//конструктор по умолчанию
  23.  
  24. Cdate (int a, int b, int c)//конструктор
  25. {
  26. iday=a;
  27. imonth=b;
  28. iyear=c;
  29. }
  30.  
  31.  
  32.  
  33. private:
  34. int iday;
  35. int imonth;
  36. int iyear;
  37.  
  38. }D;
  39.  
  40.  
  41.  
  42. void main()
  43. {
  44. SetConsoleCP(1251);
  45. SetConsoleOutputCP(1251);
  46.  
  47. while(true)
  48. {
  49. Cdate DateTime (13, 01, 2012);
  50. Cdate DateTime1 (13, 01, 2013);
  51.  
  52. system("pause");
  53. system("cls");
  54. }
  55. }
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: ‘DateTime’ does not name a type
prog.cpp:20: error: ISO C++ forbids declaration of ‘DateTime’ with no type
prog.cpp:42: error: ‘::main’ must return ‘int’
prog.cpp: In function ‘int main()’:
prog.cpp:44: error: ‘SetConsoleCP’ was not declared in this scope
prog.cpp:45: error: ‘SetConsoleOutputCP’ was not declared in this scope
prog.cpp:52: error: ‘system’ was not declared in this scope
stdout
Standard output is empty