Advertisement
ZhilinskiyG

Task 2_17

Feb 29th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     cout << "Input the strength of a pirate ship" << endl;
  6.     float a;
  7.     cin >> a;
  8.     cout << "Input the strength of the English ship" << endl;
  9.     float b;
  10.     cin >> b;
  11.     float c;
  12.     float d;
  13.     do {
  14.         cout << "Input the force attacks of pirates" << endl;
  15.         cin >> c;
  16.         a = a - c;
  17.         cout << "Input the force attacks of England" << endl;
  18.         cin >> d;
  19.         b = b - d;
  20.         cout << a<<endl;
  21.         cout << b<<endl<<endl;
  22.     } while (a > 0 && b > 0);
  23.     if ((a <= 0) && (b>0)) {
  24.         cout << "The England win! " << endl;
  25.     }
  26.     else {
  27.         if ((a>0) && (b <= 0)) {
  28.             cout << "Pirats win!" << endl;
  29.         }
  30.         else {
  31.                 cout << "DRAW"<<endl;
  32.         }
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement