fork download
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6.  
  7. class times {
  8.  
  9. public:
  10. times();
  11. times(int M, int S);
  12.  
  13. void show() const;
  14.  
  15.  
  16. private:
  17. int minutes;
  18. int seconds;
  19. };
  20.  
  21.  
  22. times::times() : minutes(0), seconds(0) {}
  23.  
  24. times::times(int M, int S) : minutes(M), seconds(S) {}
  25.  
  26.  
  27. void times::show() const {
  28. cout<< endl << minutes<< " : " <<seconds;
  29. }
  30.  
  31. times make_times() {
  32. int a, b;
  33.  
  34. cout << "Введите минуты: ";
  35. cin >> a;
  36.  
  37. cout << "Введите секунды: ";
  38. cin >> b;
  39.  
  40. return times(a, b);
  41. }
  42.  
  43.  
  44. int main() {
  45. // приблуды для локализации
  46.  
  47. times A = make_times();
  48. A.show();
  49. }
  50.  
Success #stdin #stdout 0s 2856KB
stdin
45 7
stdout
Введите минуты: Введите секунды: 
45 : 7