In my C++ program i am writing the time is taken in.
The integers hrs and mins are reading the values and the whole program works except for this little problem
When entering a time such as 9 (for hrs) i cant use a leading zero 0 9 as an error occurs - what causes it?
cheers for any help i recieve guys
The integers hrs and mins are reading the values and the whole program works except for this little problem
When entering a time such as 9 (for hrs) i cant use a leading zero 0 9 as an error occurs - what causes it?
Code:
void getParkTime(int& hrs, int& mins) { int h,m; h = 0; m = -1; gotoxy(2,4); clreol(); cout<<"Arrival time "; while ((h< 7) || (h > 20)) { gotoxy(2,5); clreol(); // inserted as noted above 3.12.04 cout<<"hrs:"; gotoxy(7,5); clreol(); // inserted as noted above 3.12.04 cin>>h; } while ((m < 0) || (m> 59)) { gotoxy(2,6); clreol(); // inserted as noted above 3.12.04 cout<<"mins:"; gotoxy(8,6); clreol(); // inserted as noted above 3.12.04 cin>>m; } hrs = h; mins = m; }
Comment