Professional Documents
Culture Documents
Title:: Stone, Paper and Scissors Game
Title:: Stone, Paper and Scissors Game
CODING:
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <string>
int main() {
srand(static_cast<unsigned int>(time(NULL)));
string userChoice;
int computerNumber = rand() % 3 + 1;
string computerChoice;
string userName;
if (computerNumber == 1) {
computerChoice = "rock";
} else if (computerNumber == 2) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}
std::cout << "Welcome to rock, paper, scissors! What is your name?" << endl;
getline(cin, userName);
std::cout << "Hello " << userName << "! What do you choose?" << endl;
getline (cin,userChoice);
INPUT:
OUTPUT:
SOURCE:
I have made this program in window in python of version 3.0 .
BIBLIOGRAPHY:
Google games websites
Codementor.io
Computer programming: Python books
Also, Tic tac toe gaming apps.
THANK YOU. . .
Mansi
UID: 19BSP7043
CP ASSIGNMENT