Rock, paper, scissors C++ (beginners)

#include <iostream>
using namespace std;
int main() {
  char computer, player;
  char options[] = {'r', 'p', 's'};

  while(1){
    cout<<"(r) Rock, (p) Paper, (s) Scissors"<<endl;
    cout<<"You: ";
    cin>>player;
    srand(time(NULL));
    int randNum = (rand() % 3);
    computer = options[randNum];
    cout<<"Computer: "<<computer<<endl;
    if(computer == player)
      cout<<"Tie"<<endl;
    if(player == 's' && computer == 'r')
      cout<<"You loss"<<endl;
    if(player == 's' && computer == 'p')
      cout<<"You win"<<endl;
    if(player == 'r' && computer == 'p')
      cout<<"You loss"<<endl;
    if(player == 'r' && computer == 's')
      cout<<"You win"<<endl;
    if(player == 'p' && computer == 'r')
      cout<<"You win"<<endl;
    if(player == 'p' && computer == 's')
      cout<<"You loss"<<endl;
  }

}
A %d blogueros les gusta esto: