먼저 죄송하다고 말씀먼저 올립니다. 이런거 물어볼자리가 아닌곳이
알면서도 불구하고 염치없이 물어봐서..
다름이 아니고
시간 분 초를 집어넣을때 예를 들어
(HH:MM:SS)에서 1시40분25초 경우엔 01:40:25로 나타내야 하는데
1:40:25로 나타낼경우 에러메세지를 나게끔해야되거든요.
이럴때 어떻게 해야할지 막상 생각하려니 어렵네요.
좀 알려주시면 고맙겠습니다.
밑에건 소오스 프로그램입니다.
#include <iostream.h>
#include <iomanip.h>
#define MAX_LINE 1024 // maximum length of input line
int main()
{
int hour, minute, second; // the time components
int month, day, year; // the date components
char description[MAX_LINE]; // appointment description
char c;
while ( true ) {
while ( true ) {
cout << "nEnter a time of the event (HH:MM:SS) ===> ";
cin >> hour >> c >> minute >> c >> second;
if (hour > 24 || minute > 60 || second > 60 )
/*바로 여기에 그조건문이 들어가야할것 같은데 부탁드립니다.(- -)(_ _)꾸벅*/
{
cout << "that 's invaild timen";
cin.clear(); // clear error flags
cin.ignore(MAX_LINE, 'n'); // skip to a newline
break; // go to prompt
}
☞ 본 게시판에서 모발이식 수술 후기는 신고 바랍니다. (삭제 및 탈퇴)
댓글