Hi I am completely new to the programming and I got 0/10 on my last algorithm in pseudo code. I need to write an algorithm using pseudo code to score a tennis match. The algorithm takes two scores and the player who won the point as input and retuen the new scores. Any help?

>Any help?
Yes, plenty. But you'll have to make an attempt first. No effort on your part results in no effort on our part.

Sorry about that, here is what I have managed so far.

Prompt user for 3 values
int score_1, score_2, player;

player = 1,2;


if (winner = 1) then
score_1 = score_1 +15
else
score_2 = score_2 +15

if score_1, score_2 >= 40 then
game
End if;

I'm thinking I use else so if player 2 wins then he gets the +15 score instead of adding another if statement.

Is this a running score program? Are you breaking the match down into sets and games? It's possible that you're oversimplifying, but I can't be sure without a more detailed description of the problem.

It's broken down the specific set so that if you entered 15 15 2 the output would be 15 30 and then you continue input until a player has won the set. Once the set if finished it outputs game.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.