Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <ctime>
  5. #include <string>
  6. #include <thread>
  7. #include <fstream>
  8.  
  9.  
  10. using namespace std;
  11.  
  12. void starter();
  13. void menu();
  14. void wybor();
  15. void listaslowek();
  16. void noweslowko();
  17. void informacje();
  18. void powrot();
  19. void koniec();
  20. void usunslowko();
  21. void test();
  22.  
  23. int main()
  24. {
  25. starter();
  26. menu();
  27. }
  28.  
  29. void starter()
  30. {
  31. cout << "||||||||||||||||||" << endl;
  32. cout << "||| ENGLISH |||" << endl;
  33. cout << "|||| TEST ||||" << endl;
  34. cout << "||||||||||||||||||" << endl;
  35. system("PAUSE");
  36. }
  37.  
  38. void koniec()
  39. {
  40. system("CLS");
  41. for (int i = 5; i > 0; i--)
  42. {
  43. cout << i;
  44. this_thread::sleep_for(chrono::seconds(1));
  45. system("CLS");
  46. }
  47. cout << endl << "Press any button to exit..." << endl;
  48. }
  49.  
  50. void powrot()
  51. {
  52. system("PAUSE");
  53.  
  54. menu();
  55. }
  56.  
  57. void listaslowek()
  58. {
  59. system("CLS");
  60. string slowko;
  61.  
  62. cout << "List of words:" << endl;
  63.  
  64. fstream lista;
  65. lista.open("lista.txt", fstream::in);
  66.  
  67. while (lista >> slowko)
  68. {
  69. cout << slowko << endl;
  70. }
  71.  
  72. powrot();
  73. }
  74.  
  75. void noweslowko()
  76. {
  77. system("CLS");
  78.  
  79. string NewWord;
  80. cout << "Write new word: ";
  81. cin >> NewWord;
  82. ofstream lista;
  83. lista.open("lista.txt", ofstream::app);
  84. lista << endl << NewWord;
  85. lista.close();
  86. cout << endl << "Word '" << NewWord << "' has been successfully added" << endl;
  87.  
  88. powrot();
  89. }
  90.  
  91. void usunslowko()
  92. {
  93. system("CLS");
  94.  
  95. string DeletedWord;
  96. cout << "Write a word to delete: ";
  97. cin >> DeletedWord;
  98. cout << endl << "Word '" << DeletedWord << "' has been successfully deleted" << endl;
  99. powrot();
  100. }
  101.  
  102. void test()
  103. {
  104. system("CLS");
  105.  
  106. cout << "in progress..." << endl;
  107. powrot();
  108. }
  109.  
  110. void informacje()
  111. {
  112. system("CLS");
  113.  
  114. cout << "The English test made for a math class!" << endl;
  115. cout << endl << "List of words: [LICZBA WSZYSTKICH SLOWEK]" << endl;
  116. cout << "Creators: Przemek Szumczyk & Bartek Modliszewski" << endl;
  117. cout << "License: GNU General Public License" << endl;
  118. powrot();
  119. }
  120.  
  121. void wybor()
  122. {
  123. char liczba;
  124. cout << "Select the tab: ";
  125. cin >> liczba;
  126. switch (liczba)
  127. {
  128. case '1': listaslowek(); break;
  129. case '2': noweslowko(); break;
  130. case '3': usunslowko(); break;
  131. case '4': test(); break;
  132. case '5': informacje(); break;
  133. case '6': koniec(); break;
  134. }
  135. }
  136.  
  137. void menu()
  138. {
  139. system("CLS");
  140.  
  141. cout << "1. List of words" << endl;
  142. cout << "2. Add word" << endl;
  143. cout << "3. Remove word" << endl;
  144. cout << "4. TEST!!!" << endl;
  145. cout << "5. Informations" << endl;
  146. cout << "6. Shut down" << endl;
  147. wybor();
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement