C++ "Clock" Program Showing the Use of Nested for loops

This program does not accurately tell time, I am just using the clock to illustrate three sets of numbers which have differenent maximum values, change and different rates but are nontheless interdependent. It shows time in military. You enter the present time(or whatever time you like) and let it run. It is an endless loop that you must break out of using < Ctrl > - C. It will display the time every "second."
#include < stdio.h >
#include < iostream.h >
#include < stdlib.h >

int main( ){

int ms;
int seconds;
int minutes;
int hours;
cout << "The hour?: ";
cin >> hours;
cout << "\nThe minutes?: ";
cin >> minutes;
cout << "\n";
  for(hours; hours <24; hours++){
    for(minutes; minutes < 60; minutes++){
      for(seconds=0; seconds < 60; seconds++){
        cout << hours << ":" << minutes << ":" << seconds << endl ;
          for(ms = 0; ms <=25000000; ms++){

return 0;


What we have here is a for loop structure that is 4 loops deep. When the ms counter reaches it's max, it increments the seconds count, then goes back to zero and starts counting again. When the seconds count reaches its max, it increments the minutes by one and resets to zero. The minutes counter does the same thing to the hour counter.

You may calabrate it to match your computer's speed by changing the initial ms value.