unkown error with R/P/S
I am getting an unexpected error while trying to compile this R/P/S game, but MS Visual Studio does not seam to display where the error is!?
Can some one help?
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
/*
Simple rock paper scissors game.
*/
#include<iostream>
#include<limits>
#include<cstdlib>
#include <otime>
using namespace std;
#define win Congrats, you won!
#define loose Sorry, good luck next time!
int main(){
// declaring variables
int choose;
int i;
char res;
cout << "Welcome" << endl;
// Choices
cout << "Rock Paper Scissors" << endl;
cout << "Please choose an option" << endl;
cout << "r) Rock" << endl;
cout << "p) Paper" << endl;
cout << "s) Scissors" << endl;
// starts the else if statements
cin >> choose;
if (choose == 'r'){
cout << "My choice is.\n"''
}
else if (choose == 'p'){
cout << "My choice is.\n";
}
else if (choose == 's'){
cout << "My choice is.\n";
}
else {
cout << "Invalid option!\n";
}
//////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// creating the generator
seed = time(0);
srand(seed);
comp = rand() % 3 + 1;
if (comp == 1) {
res = 1;
cout << "Rock\n";
}
else if (comp == 2) {
res = 2;
cout << "Paper\n";
}
else (comp == 3){
res = 3
cout << "Scissors\n";
}
system("pause");
return 0;
}
|
Last edited on
37 38
|
if (choose == 'r'){
cout << "My choice is.\n"''
|
What's up with the single quotes on line 38?
In addition
cout << "My choice is.\n"''
Missing semicolon
Topic archived. No new replies allowed.