I've found a simple timer program and it seems to work (for the most part). The problem is that certain cout functions aren't showing up. The timer originally didn't include milliseconds in the code, so I added them myself (which could be the problem) based on the code for the other parts of the timer.
The first part that is a problem is that the "Press any key to start" statement doesn't show up. Well, it does briefly, then just begins the program as if it didn't really even exist That wasn't my addition to the code. The second part is that the milliseconds portion of the code doesn't seem to exist, as far as the compiler is concerned. It just doesn't display it. I can't input it once compiled, and it doesn't show up in the program at all.
Any ideas? I'm a beginner so I'm sure I screwed it up somewhere.
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <windows.h>
#include <time.h>
using namespace std;
int main()
{
int m,s,h,ms;
cout << "A COUNTDOWN TIMER" << endl;
cout << "enter time in hours here" << endl;
cin >> h;
cout << "enter time in minutes here " << endl;
cin >> m;
cout << "enter time in seconds here" << endl;
cin >> s;
cout << "enter time in milliseconds here" << endl;
cin >> ms;
Sleep (50000000);
cout << "Press any key to start" << endl;
Sleep (50000000);
cout << " A COUNTDOWN TIMER" << endl;
cout << "time remaining" << endl;
cout << "hours: " << h << "mins: " << m << " secs: " << s << " milli: " << ms << endl;
for (int hour = h; hour >= 0; hour--)
{
for (int min = m; min >= 0 ; min--)
{
if ( min == 0 && h > 0)
m = 59;
for (int sec = s; sec >= 0; sec--)
{
if ( sec == 0 )
s = 59;
{
for ( int milli = ms; ms>= 0 ; ms-- );
if ( ms == 0 )
ms = 99;
Sleep(50000000);
system("cls");
cout << hour << " :hours " << min << " :mins " << sec << " :secs" << ms << " :milli " << endl;
}
}
Sleep(50000000);
cout << "THE END" << endl;
return 0;
}