1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include "stdafx.h" //No idea what this is, but if it's not a custom header, it should probably be in angle brackets <>
#include <iostream>
#include <string>
using namespace std;
int main()
{
//none of these are declared
//remove "std::" you're already telling the compiler you're using it
std::string Rock, Paper, Scissors, n;
cout <<"Please enter either Rock, Paper, Scissors and press ENTER:" << endl;
cin >> n; //use getline(cin, n);
//Rock, Paper, and Scissors are not declared to anything
if ( n!=Rock || n!=Paper || n!=Scissors){
cout << "You did not enter Rock, Paper, or Scissors" << endl;
cout << "Please enter Rock, Paper, or Scissors" << endl;
cin >> n; //use getline(cin, n);
}
if (n==Rock){
cout << "I pick Paper" << endl;
cout << "I win!";
}
if (n==Paper){
cout << "I Pick Scissors" << endl;
cout << "I win!";
}
if (n==Scissors){
cout << "I pick Rock" << endl;
cout << "I win!";
}
system("PAUSE"); //avoid using this as much as possible. Read second thread in the beginners forum.
return 0;
}
|