Advertisement
Guest User

main.cpp

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