How to use getch() without waiting for input?
问题 for (;;) { cout << "You are playing for:" << playtime << "seconds." << endl; cout << "You have " << bytes << " bytes." << endl; cout << "You are compiling " << bps << " bytes per second." << endl; cout << "Press a to buy assembler monkey (produces 1 byte per second)/(cost 10 bytes)" << endl; switch(getch()) { case 'a': bytes = bytes - 10; bps++; break; } bytes = bytes + bps; playtime++; Sleep(1000); system("cls"); } Let's say that's my incremental game. I want refresh my game after 1 second.