Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // mates.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- #define PRIPRAVA 20
- #define PREDMYTI 20
- #define MYTI 30
- #define DRUHE_MYTI 20
- #define SUSENI 25
- typedef enum {
- SEM_STATES_PRIPRAVA,
- SEM_STATES_PREDMYTI,
- SEM_STATES_MYTI,
- SEM_STATES_DRUHE_MYTI,
- SEM_STATES_SUSENI,
- SEM_STATES_STOP
- } SEM_STATES;
- SEM_STATES SemStates;
- int Timer = 0;
- void StopState();
- void PripravaState();
- void PredmytiState();
- void MytiState();
- void DruheMytiState();
- void SuseniState();
- int _tmain(int argc, _TCHAR* argv[])
- {
- SemStates = SEM_STATES_STOP;
- while (true){
- system("cls");
- switch (SemStates)
- {
- case SEM_STATES_STOP:
- StopState();
- break;
- case SEM_STATES_PRIPRAVA:
- PripravaState();
- break;
- case SEM_STATES_PREDMYTI:
- PredmytiState();
- break;
- case SEM_STATES_MYTI:
- MytiState();
- break;
- case SEM_STATES_DRUHE_MYTI:
- DruheMytiState();
- break;
- case SEM_STATES_SUSENI:
- SuseniState();
- break;
- default:
- break;
- }
- Sleep(100);
- }
- return 0;
- }
- void StopState(){
- char c;
- printf("Zastaveno\n");
- printf("Zvolte program:\n");
- printf("[1] Oplach\n");
- printf("[2] Myti ECO\n");
- printf("[3] Myti 65%c \n", 248);
- printf("[3] Myti 70%c \n", 248);
- fflush(stdin);
- scanf_s("%c", &c);
- SemStates = SEM_STATES_PRIPRAVA;
- Timer = 0;
- }
- void PripravaState(){
- if (Timer < PRIPRAVA){
- printf("Priprava: %f", (PRIPRAVA - Timer) / 10.0);
- Timer++;
- }
- else{
- SemStates = SEM_STATES_PREDMYTI;
- Timer = 0;
- }
- }
- void PredmytiState(){
- if (Timer < PREDMYTI){
- printf("Predmyti: %f", (PREDMYTI - Timer) / 10.0);
- Timer++;
- }
- else{
- SemStates = SEM_STATES_MYTI;
- Timer = 0;
- }
- }
- void MytiState(){
- if (Timer < MYTI){
- printf("Myti: %f", (MYTI - Timer) / 10.0);
- Timer++;
- }
- else{
- SemStates = SEM_STATES_DRUHE_MYTI;
- Timer = 0;
- }
- }
- void DruheMytiState(){
- if (Timer < DRUHE_MYTI){
- printf("Druhe myti: %f", (DRUHE_MYTI - Timer) / 10.0);
- Timer++;
- }
- else{
- SemStates = SEM_STATES_SUSENI;
- Timer = 0;
- }
- }
- void SuseniState(){
- if (Timer < SUSENI){
- printf("Suseni: %f", (SUSENI - Timer) / 10.0);
- Timer++;
- }
- else{
- SemStates = SEM_STATES_STOP;
- Timer = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement