#include <iostream>
#include <string>
using namespace std;
string player1_name = "Todd";
string player2_name = "Mandy";
int score1;
int score2;
string determine_winner(int score1, int score2) {
string winner_message;
if(score1 > score2){
winner_message = player1_name + " won the game.";
}
else if(score2 > score1){
winner_message = player2_name + " won the game.";
}
else if(score1 == score2){
winner_message = player1_name + " and " + player2_name + " tied";
}
else{
winner_message = "Cannot determine winner";
}
return winner_message;
}
int main() {
cout << "What is the score of player 1? ";
cin >> score1;
cout << "What is the score of player 2? ";
cin >> score2;
cout << determine_winner(score1, score2);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: