Advertisement
Guest User

smok_dzialajacy

a guest
Feb 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. void atak_smoka(int &a, int b)
  7. {
  8. int procent;
  9. procent=b*5;
  10. procent/=100;
  11. a=a-procent;
  12. }
  13.  
  14. void luk(int &a)
  15. {
  16. a=a-50;
  17. }
  18.  
  19. void topor(int &a, int&b)
  20. {
  21. a=a-15;
  22. b=b-150;
  23. }
  24.  
  25. void fireball(int &a, int&b)
  26. {
  27. a=a-40;
  28. b=b-400;
  29. }
  30.  
  31. void lekarstwo(int &a)
  32. {
  33. a=a+40;
  34. }
  35. void stan(int a, int b)
  36. {
  37. cout<<"masz "<<a<<" "<<"hp! "<<endl;
  38. cout<<"smok ma "<<b<<" "<<"hp! "<<endl;
  39. }
  40.  
  41. int main()
  42. {
  43. int hp1=100,hp2=1000,i=4;
  44. int wybor;
  45. cout << "=========================================" << endl;
  46. cout << "Witaj w grze Darwin vs Dragon, masz 100hp"<< endl<< "Twoj przeciwnik 1000! powodzenia! " << endl;
  47. cout << "=========================================" << endl;
  48. cout <<" "<< endl;
  49. stan(hp1,hp2);
  50. while(hp1>0 && hp2>0)
  51. {
  52. cout<<endl;
  53. cout<<endl;
  54. cout<<"fireball atak [1]"<<endl;
  55. cout<<"topor atak [2]"<<endl;
  56. cout<<"luk atak [3]"<<endl;
  57. cout<<"lekarstwo uzyj [4]"<<endl;
  58. cout<<"wybierz: ";
  59. cin>>wybor;
  60. cout<<endl;
  61.  
  62. switch(wybor)
  63. {
  64. case 1:
  65. system( "cls" );
  66. fireball(hp1,hp2);
  67. atak_smoka(hp1,hp2);
  68. stan(hp1,hp2);
  69. cout<<"uzyles fireball! "<<endl;
  70. break;
  71.  
  72. case 2:
  73. system( "cls" );
  74. topor(hp1,hp2);
  75. atak_smoka(hp1,hp2);
  76. stan(hp1,hp2);
  77. cout<<"uzyles topor! "<<endl;
  78. break;
  79.  
  80. case 3:
  81. system( "cls" );
  82. luk(hp2);
  83. atak_smoka(hp1,hp2);
  84. stan(hp1,hp2);
  85. cout<<"uzyles luk! "<<endl;
  86. break;
  87.  
  88. case 4:
  89. while(i!=0)
  90. {
  91. system( "cls" );
  92. lekarstwo(hp1);
  93. atak_smoka(hp1,hp2);
  94. stan(hp1,hp2);
  95. cout<<"uzyles lekarstwa! "<<endl;
  96. i--;
  97. break;
  98. }
  99. cout<<"Nie masz juz leczenia! "<<endl;
  100. }
  101. if(hp1<=0)
  102. {
  103. system("cls");
  104. cout<<"Przegrales";
  105. cout<<endl;
  106. }
  107. else if(hp2<=0)
  108. {
  109. system("cls");
  110. cout<<"Wygrales";
  111. cout<<endl;
  112. }
  113. }
  114.  
  115. return 0;
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement