Advertisement
Guest User

Untitled

a guest
May 26th, 2015
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. // mates.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <windows.h>
  8.  
  9. #define PRIPRAVA 20
  10. #define PREDMYTI 20
  11. #define MYTI 30
  12. #define DRUHE_MYTI 20
  13. #define SUSENI 25
  14.  
  15. typedef enum {
  16. SEM_STATES_PRIPRAVA,
  17. SEM_STATES_PREDMYTI,
  18. SEM_STATES_MYTI,
  19. SEM_STATES_DRUHE_MYTI,
  20. SEM_STATES_SUSENI,
  21. SEM_STATES_STOP
  22. } SEM_STATES;
  23.  
  24. SEM_STATES SemStates;
  25.  
  26. int Timer = 0;
  27.  
  28. void StopState();
  29. void PripravaState();
  30. void PredmytiState();
  31. void MytiState();
  32. void DruheMytiState();
  33. void SuseniState();
  34.  
  35.  
  36. int _tmain(int argc, _TCHAR* argv[])
  37. {
  38. SemStates = SEM_STATES_STOP;
  39. while (true){
  40. system("cls");
  41. switch (SemStates)
  42. {
  43. case SEM_STATES_STOP:
  44. StopState();
  45. break;
  46. case SEM_STATES_PRIPRAVA:
  47. PripravaState();
  48. break;
  49. case SEM_STATES_PREDMYTI:
  50. PredmytiState();
  51. break;
  52. case SEM_STATES_MYTI:
  53. MytiState();
  54. break;
  55. case SEM_STATES_DRUHE_MYTI:
  56. DruheMytiState();
  57. break;
  58. case SEM_STATES_SUSENI:
  59. SuseniState();
  60. break;
  61. default:
  62. break;
  63. }
  64. Sleep(100);
  65. }
  66. return 0;
  67. }
  68.  
  69. void StopState(){
  70. char c;
  71. printf("Zastaveno\n");
  72. printf("Zvolte program:\n");
  73. printf("[1] Oplach\n");
  74. printf("[2] Myti ECO\n");
  75. printf("[3] Myti 65%c \n", 248);
  76. printf("[3] Myti 70%c \n", 248);
  77. fflush(stdin);
  78. scanf_s("%c", &c);
  79. SemStates = SEM_STATES_PRIPRAVA;
  80. Timer = 0;
  81. }
  82.  
  83. void PripravaState(){
  84. if (Timer < PRIPRAVA){
  85. printf("Priprava: %f", (PRIPRAVA - Timer) / 10.0);
  86. Timer++;
  87. }
  88. else{
  89. SemStates = SEM_STATES_PREDMYTI;
  90. Timer = 0;
  91. }
  92. }
  93.  
  94. void PredmytiState(){
  95. if (Timer < PREDMYTI){
  96. printf("Predmyti: %f", (PREDMYTI - Timer) / 10.0);
  97. Timer++;
  98. }
  99. else{
  100. SemStates = SEM_STATES_MYTI;
  101. Timer = 0;
  102. }
  103. }
  104.  
  105. void MytiState(){
  106. if (Timer < MYTI){
  107. printf("Myti: %f", (MYTI - Timer) / 10.0);
  108. Timer++;
  109. }
  110. else{
  111. SemStates = SEM_STATES_DRUHE_MYTI;
  112. Timer = 0;
  113. }
  114. }
  115.  
  116. void DruheMytiState(){
  117. if (Timer < DRUHE_MYTI){
  118. printf("Druhe myti: %f", (DRUHE_MYTI - Timer) / 10.0);
  119. Timer++;
  120. }
  121. else{
  122. SemStates = SEM_STATES_SUSENI;
  123. Timer = 0;
  124. }
  125. }
  126.  
  127. void SuseniState(){
  128. if (Timer < SUSENI){
  129. printf("Suseni: %f", (SUSENI - Timer) / 10.0);
  130. Timer++;
  131. }
  132. else{
  133. SemStates = SEM_STATES_STOP;
  134. Timer = 0;
  135. }
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement