Game: Scissor, Rock, Paper
The code has been modified slightly and now uploaded to the site.


315.cpp
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
std::string makeToString(int value){
switch(value){
case 0:
return "scissor";
case 1:
return "rock";
case 2:
return "paper";
}
return "";
}
int main(){
int input;
srand(time(0)); // We need this to generate a different number every time (feels weird am i right?)
int ai = rand() % 3; // Yeah we use rand() now but it also has to use modulus instead of times. Pretty much still the same as Math.random()
// std::cout << "Rand is " << ai << "\n";
std::cout << "scissor (0), rock (1), paper (2): \n";
std::cin >> input;
std::string in = makeToString(input);
std::string computer = makeToString(ai);
if (input == ai){
std::cout << "The computer is " << computer << ". You are " << in << " too. It is a draw\n";
}
else if (input > ai){
std::cout << "The computer is " << computer << ". You are " << in << ". You won\n";
}
else{
std::cout << "The computer is " << computer << ". You are " << in << ". Better luck next time\n";
}
}