i need help making this program work

#include <iostream>
using namespace std;

void compTurn(int & totalTp, int userTp, string & turn) {
if (totalTp > 4) {
totalTp = 4 - userTp;
turn = "human";
}
else if (totalTp >= 2 && totalTp <= 4) {
totalTp = 1;
turn = "human";
}
else if (totalTp == 1) {
cout << "you win " << endl;
}
}
int main()
{
string turn = "human";
int playerTp = 0;
int totalTp = 23;
int compTp = 0;

while (turn == "human") {
cout << "how mant tothpicks would you like to take? (max 3)";
cin >> playerTp;
if (playerTp >= 1 && playerTp <= 3) {
totalTp = totalTp - playerTp;
if (totalTp > 1) {
turn = "comp";
}
else if (totalTp == 1) {
cout << "you loose";
}
}
else {
cout << "please enter a value between 1 and 3" << endl;
}

}
while (turn == "comp") {
compTurn(totalTp, turn);
}
system("pause");
return 0;
}
Topic archived. No new replies allowed.