Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <time.h>
- #include <unistd.h>
- void clearConsole(const unsigned int clearHeight);
- int main() {
- bool inProgress = true;
- time_t startTime = time(NULL);
- while(inProgress) {
- sleep(1);
- if(difftime(time(NULL), startTime) == (24 * 60)) {
- clearConsole(50);
- printf("Go check the oven, bud.\n");
- printf("Your pizza is done!\n");
- inProgress = false;
- } else {
- const unsigned int elapsedTimeMinutes = (const unsigned int)difftime(time(NULL), startTime) / 60;
- const unsigned int elapsedTimeSeconds = (const unsigned int)difftime(time(NULL), startTime) - (elapsedTimeMinutes * 60);
- printf("Elapsed Time: %dm %ds\n", elapsedTimeMinutes, elapsedTimeSeconds);
- }
- }
- return 0;
- }
- void clearConsole(const unsigned int clearHeight) {
- for(unsigned int i = 0; i < clearHeight; i++) {
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement