- Rock: Shaped by making a fist with your hand.
- Paper: Created by extending your hand flat with fingers together.
- Scissors: Made by extending your hand and separating your index and middle fingers to form a "V" shape.
The objective of the game is to defeat your opponent by selecting a hand gesture that defeats theirs. The rules of rock-paper-scissors are straightforward:
- Rock crushes scissors: If a player shows rock and the other shows scissors, the rock wins.
- Scissors cut paper: Scissors defeat paper.
- Paper covers rock: Paper defeats rock.
If both players reveal the same hand gesture, it results in a tie, and the game is usually played again.
Header files in the code:
iostream: This header file allows input and output operations. It is used to display output messages and read input from the user.
cstdlib: This header file provides various general-purpose functions, including generating random numbers using rand() and srand(). In the code, it is used for generating a random number for the computer's choice in the game.
ctime: This header file provides functions to work with date and time in C++. It is used in conjunction with srand() to seed the random number generator with the current time (time(0)).