SRM 144 DIV 2 (200)

Programming/SRM Practice 2009. 5. 26. 16:29
SRM 144 DIV 2 (200)
문제 요약 : 입력된 초를 시간:분:초로 바꿔서 반환하라.

#include <iostream>

using namespace std;

 

class Time

{

public:

  string whatTime(int seconds);

};

 

string Time::whatTime(int seconds)

{

  char temp[10];

 

  sprintf(temp, "%d:%d:%d",
          (seconds / 60) / 60, (seconds / 60) % 60, seconds % 60);

  string time = temp;

 

  return time;

}

'Programming > SRM Practice' 카테고리의 다른 글

SRM 370 DIV 2 (250)  (0) 2009.05.26
SRM 205 DIV 2 (250)  (0) 2009.05.26
SRM 200 DIV 2 (250)  (0) 2009.05.26
SRM 197 DIV 2 (250)  (0) 2009.05.26
SRM 145 DIV 2 (250)  (0) 2009.05.26
: