Advertisement
Guest User

attempt4

a guest
Nov 7th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.  
  7.     char move;
  8.     bool quit = false;
  9.     int phealth;
  10.     int ophealth;
  11.  
  12.     cout << "===========================================" << endl;
  13.     cout << "Welcome to the Street Fighter Tutorial Game" << endl;
  14.     cout << "Attack the opponent until the healbar is 0!" << endl;
  15.     cout << "===========================================" << endl;
  16.     cout << " " << endl;
  17.  
  18.     phealth = 100;
  19.     ophealth = 100;
  20.  
  21.  
  22.     while (!quit) {
  23.  
  24.         cout << "Player Health: " << phealth << " ===== VS ===== Opponent Health: " << ophealth << endl;
  25.         cout << " " << endl;
  26.         cout << "Chose one of the following moves:" << endl;
  27.         cout << "(1) Hadouken:                          10 HP" << endl;
  28.         cout << "(2) Shoryuken:                         15 HP" << endl;
  29.         cout << "(3) Hurrican Kick:                     20 HP" << endl;
  30.         cin >> move;
  31.  
  32.  
  33.        
  34.         if (move == '1') {
  35.             cout << " " << endl;
  36.             cout << "You did a HADOUKEN attack!         -(10HP)" << endl;
  37.             ophealth = (ophealth - 10);
  38.         }
  39.         else if (move == '2') {
  40.             cout << "You did a SHORYUKEN attack!        -(15HP)" << endl;
  41.             ophealth = (ophealth - 15);
  42.         }
  43.         else if (move == '3') {
  44.             cout << "You did a HURRICAN KICK attack!    -(20HP)" << endl;
  45.             ophealth = (ophealth - 20);
  46.         }
  47.         else if ((move != '1') || (move != '2' || (move != '3')) {
  48.             cout << "Please enter a valid number!" << endl;
  49.         }
  50.         else if (ophealth < 20) {
  51.             cout << "u win" << endl;
  52.             quit = true;
  53.         }
  54.         else if (phealth <= 20) {
  55.             cout << "u lose" << endl;
  56.             quit = true;
  57.         }
  58.  
  59.  
  60.  
  61.     }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement