No está dentro de la clase, no es un prototipo, ni tapmoco está dentro del main, así que no sé a qué corresponde, alguien me podría decir por qué está ahí y qué es?
Ese código no es parte de la clase? No debería ir adentro?
Código
#include <iostream> using namespace std; class Time{ public: Time(); void setTime(int, int, int); void printMilitary(); void printStandard(); private: int hour; int minute; int second; }; //ESTE CODIGO Time::Time() {hour = minute = second = 0;} void Time::setTime(int h, int m, int s){ hour = (h >= 0 && h < 24) ? h :0; minute = (m >= 0 && m < 60) ? m :0; second = (s >= 0 && s < 60) ? s :0; } void Time::printMilitary(){ cout << (hour < 10 ? "0" : "") << hour << ":" << (minute < 10 ? "0" : "") << minute << ":" << (second < 10 ? "0" : "") << second; } void Time::printStandard(){ cout << ((hour == 0 || hour == 12) ? 12 : hour % 12) << ":" << (minute < 10 ? "0" : "") << minute << ":" << (second < 10 ? "0" : "") << second << (hour < 12 ? " AM" : " PM"); } // ESTE CODIGO main(){ Time t; cout << "The initial military time is "; t.printMilitary(); cout << "\nThe initial standar time is "; t.printStandard(); t.setTime(13, 27, 6); cout << "\n\nMilitary time after seTime is "; t.printMilitary(); cout << "\nStandar time after setTime is "; t.printStandard(); t.setTime(99, 99, 99); cout << "\n\nAfter attempting invalid settings:\n" << "Military Time: "; t.printMilitary(); cout << "\Standard time: "; t.printStandard(); cout << endl; return 0; }