Advertisement
Guest User

main.cpp

a guest
Oct 26th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. #include <windows.h>
  5. #include "Menu.hpp"
  6. #include <cstdlib>
  7.  
  8.  
  9. using namespace std;
  10.  
  11. string strImie;
  12. int nKlasa;
  13. int nMenu;
  14. int nWiek;
  15.  
  16. //Wczytywanie gry
  17.  
  18. /*class Save
  19. {
  20. public:
  21. void save()
  22. {
  23. sejw.open("savefile.txt", ios::out);
  24. sejw << WARTOSC << endl;
  25. sejw.close();
  26. sejw.clear;
  27. exit(0);
  28. }
  29. }
  30. int main ()
  31. {
  32. sejw.open("savefile.txt", ios::in)
  33. if(sejw.good()==false)
  34. {
  35. cout<<"Plik z zapisem nie istnieje";
  36. getch();
  37. exit(0);
  38. }
  39.  
  40. }
  41. */
  42.  
  43.  
  44. // Gra
  45.  
  46. void Gra()
  47. {
  48. if (nKlasa == 1);
  49. cout << "Gratulacje! Wybrales klase Rycerz." << endl; //Ustawic aby wyswietlala sie jedna opcja
  50. if (nKlasa == 2);
  51. cout << "Gratulacje! Wybrales klase Lucznik." << endl;
  52. if (nKlasa == 3);
  53. cout << "Gratulacje! Wybrales klase Mag." << endl;
  54.  
  55. }
  56.  
  57. //Klasy
  58.  
  59. void rycerz()
  60. {
  61. const int SILA = 10;
  62. const int ZRECZNOSC = 4;
  63. const int MAGIA = 0;
  64.  
  65. }
  66.  
  67. void lucznik()
  68. {
  69. const int SILA = 4;
  70. const int ZRECZNOSC = 10;
  71. const int MAGIA = 0;
  72. }
  73.  
  74. void mag()
  75. {
  76. const int SILA = 0;
  77. const int ZRECZNOSC = 0;
  78. const int MAGIA = 10;
  79.  
  80. }
  81.  
  82. void profil()
  83. {
  84. cout << endl;
  85. cout << "Moze opowiesz cos o sobie?" << endl;
  86. cout << "Podaj swoje imie: "; cin >> strImie;
  87. cout << "Podaj swoj wiek: "; cin >> nWiek;
  88. cout << endl;
  89. Sleep(1000);
  90. cout << "Czas wybrac klase postaci. Oto twoje opcje:" << endl;
  91. cout << endl;
  92.  
  93. Sleep(3000);
  94. cout << "Rycerz:" << endl;
  95. cout << "Sila: 10" << endl;
  96. cout << "Zrecznosc: 4" << endl;
  97. cout << "Magia: 0" << endl;
  98. cout << endl;
  99.  
  100. Sleep(2000);
  101. cout << "Lucznik:" << endl;
  102. cout << "Sila: 4" << endl;
  103. cout << "Zrecznosc: 10" << endl;
  104. cout << "Magia: 0" << endl;
  105. cout << endl;
  106.  
  107. Sleep(2000);
  108. cout << "Mag:" << endl;
  109. cout << "Sila: 0" << endl;
  110. cout << "Zrecznosc: 0" << endl;
  111. cout << "Magia: 10" << endl;
  112. cout << endl;
  113.  
  114.  
  115. //Wybor klasy
  116.  
  117. cout << "Twoj wybor(1. Rycerz, 2. Lucznik, 3. Mag)"; cin >> nKlasa;
  118.  
  119. switch (nKlasa)
  120. {
  121. case 1:
  122. rycerz(); break;
  123. case 2:
  124. lucznik(); break;
  125. case 3:
  126. mag(); break;
  127. }
  128. //Po wyborze klasy nastepuje przeniesienie do funkcji gry
  129.  
  130. Gra();
  131.  
  132. getch();
  133. }
  134. int main()
  135. {
  136. Sleep(300);
  137. cout <<
  138. "*********************************************" << endl;
  139. Sleep(300);
  140. cout << "Margonem V2.0" << endl;
  141. Sleep(300);
  142. cout <<
  143. "*********************************************" << endl;
  144. Sleep(300);
  145. cout << "Witaj w niezapomnianym swiecie. Twoja historia rozpoczyna" << endl;
  146. Sleep(300);
  147. cout << "sie po katastrofie statku na ktorym plynales." << endl;
  148. Sleep(300);
  149. cout << "Budzisz sie na plazy." << endl;
  150. Sleep(300);
  151. cout << endl;
  152.  
  153. //Menu
  154.  
  155. cout << "1. Rozpocznij gre" << endl;
  156. cout << "2. Wyjscie" << endl;
  157. cout << " Twoj wybor (1 lub 2)";
  158. cin >> nMenu;
  159.  
  160. switch(nMenu)
  161. {
  162. case 1:
  163. profil();
  164. case 2:
  165. break;
  166. }
  167.  
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement