96. Client-server Fizz-Buzz

Write a client-server application that can be used for playing the Fizz-Buzz game. The client sends numbers to the server that answer back with fizz, buzz, fizz-buzz, or the number itself, according to the game rules. Communication between the client and the server must be done over TCP. The server should run indefinitely. The client should run as long as the user enters numbers between 1 and 99.

Fizz-Buzz is a game for children, intended to teach them arithmetic division. A player must say a number and another player should answer with:

  • Fizz, if the number is divisible by 3
  • Buzz, if the number is divisible by 5
  • Fizz-buzz, if the number is divisible by both 3 and 5
  • The number itself in all other cases

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.