#include <iostream>
#include <string>
#include <random>
#include <ctime>
usingnamespace std;
int main()
{
default_random_engine randomGenerator(time(0));
uniform_int_distribution<int> attackRoll(1, 6);
int numcap;
int numcom;
cout << "///WAR: CAPITALISTS VS. COMMUNISTS///\n" << endl;
cout << "Input the number of CAPITALISTS:\n";
cin >> numcap;
cout << "There will be " << numcap <<" capitalists in the war.\n" << endl;
cout << "Input the number of COMMUNISTS: \n" << endl;
cin >> numcom;
cout << "There will be " << numcom <<" communists in the war.\n" << endl;
cout << "Battle ensues...\n" << endl;
int attack = attackRoll(randomGenerator);
while ((numcap > 0) && (numcom > 0)) {
if (attack <= 3) {
(numcom--);}
elseif (attack >= 4) {
(numcap--);
}
}
cout <<"There are "<< numcom <<" communists and " <<numcap<< " capitalists left on the battlefield.\n" <<endl;
if (numcom == 0) {
cout << "The capitalists have won!";
}
if (numcap == 0) {
cout << "The communists have won!";
}
}