Nautical bell: Difference between revisions

correcting code→‎{{header|C++}}
No edit summary
(correcting code→‎{{header|C++}})
Line 23:
void start()
{
_inst = this; _w = 5;
watch[0] = "Middle"; watch[1] = "Morning"; watch[2] = "Forenoon"; watch[3] = "Afternoon"; watch[4] = "Dog"; watch[5] = "First";
count[0] = "One"; count[1] = "Two"; count[2] = "Three"; count[3] = "Four"; count[4] = "Five"; count[5] = "Six"; count[6] = "Seven"; count[7] = "Eight";
Line 52:
SYSTEMTIME st; GetLocalTime( &st );
int b = ( 2 * st.wHour + st.wMinute / 30 ) % 8; b = b == 0 ? 8 : b;
int w = ( 60 * st.wHour + st.wMinute ); w = w % 30 + ( w / 240 );
char hr[32]; wsprintf( hr, "%.2d:%.2d", st.wHour, st.wMinute );
 
cout << left << hr << " - " << setw( 9 ) << watch[w] << " watch - " << setw( 5 ) << count[b - 1] << " Bell";
if( b > 1 ) cout << "s"; else cout << " "; cout << " Gone." << endl;
if( b == 8 ) if( ++_w > 5 ) _w = 0;
 
for( int x = 0, c = 0; x < b; x++, c++ )
{
Line 66 ⟶ 64:
}
 
int _w;
string watch[7], count[8];
static bells* _inst;