Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #include <windows.h>
  5. using namespace std;
  6. int main()
  7. {
  8. int plansza[11][11];
  9. int zycia=3;
  10. int kolumna, wiersz;
  11. int hpUp=0;
  12. int punkty=0;
  13. //------------------------------
  14. //randomizowanie planszy
  15. //------------------------------
  16. srand(time(NULL));
  17. for(int k=1;k<11;k++)
  18. {
  19. for(int w=1;w<11;w++)
  20. {
  21. plansza[k][w]=rand()%2;
  22. }
  23. }
  24. while(zycia>0)
  25. {
  26. //------------------------------
  27. //debug wyświetlanie planszy
  28.  
  29. for(int k=1;k<11;k++)
  30. {
  31. for(int w=1;w<11;w++)
  32. {
  33. cout<<plansza[k][w];
  34. cout<<" ";
  35. }
  36. cout<<endl;
  37. }
  38.  
  39. //koniec debugu
  40. //-------------------------------
  41. cout<<"Zycia: "<<zycia<<endl;
  42. cout<<"Punkty: "<<punkty<<endl;
  43. cout<<"Streak do hp upa: "<<hpUp<<endl<<endl;
  44. cout<<"Podaj kolumne i wiersz (miedzy 1 a 10)(i oddziel enterkami mordeczko): "<<endl;
  45. cin>>kolumna;cin>>wiersz;cout<<endl;
  46. if(kolumna>10||kolumna<1||wiersz>10||wiersz<1)
  47. {
  48. system("cls");
  49. cout<<"typie gdzie ty lecisz"<<endl;
  50. }
  51. else if(plansza[kolumna][wiersz]==1)
  52. {
  53. system("cls");
  54. punkty++;
  55. hpUp++;
  56. plansza[kolumna][wiersz]=2;
  57. if(hpUp==2){zycia++;hpUp=0;cout<<"Hp Up!"<<endl;}
  58. cout<<"Hit or miss, I guess they never miss, huh?"<<endl<<endl<<endl<<endl;
  59. }
  60. else if(plansza[kolumna][wiersz]==0)
  61. {
  62. system("cls");
  63. hpUp=0;
  64. zycia--;
  65. cout<<"jak kulom w puot"<<endl<<endl<<endl<<endl;
  66. }
  67. else if(plansza[kolumna][wiersz]==2)
  68. {
  69. system("cls");
  70. cout<<"Ale to juz byloooooooo..."<<endl;
  71. cout<<"I nie wroci wieceeeeej..."<<endl<<endl<<endl<<endl;
  72. }
  73. }
  74. cout<<"przegrana mordko, wypadasz z teleturnieju"<<endl;
  75. cin.get();
  76. cin.get();
  77. return 0;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement