I do have one other problem. Im trying to put my code in a function but I'm getting errors
Code:
#include <stdlib.h>
#include <time.h>
char array[3][20] = {"Rock", "Paper", "Scissors"};
int randNum;
int randNum1;
int i;
int choice;
int playAgain;
int option;
void game(char array[int randNum],char array[int randNum1]);
int main(){
srand((unsigned)(time(0)));
printf ("Welcome to Rock Paper Scissors\n");
system ("pause");
if(option == '1')
game(array[randNum],array[randNum1]);
if(option == '2')
printf("Goodbye");
else {
printf("\t\tInvalid Entry\n\t\tPlease Try Again");
}
return 0;
system ("Pause");
}
void game(array[randNum],array[randNum1]){
randNum = rand() % 3;
randNum1 = rand() % 3;
printf("\n%s %s %s Shoot:\n\n", array[0], array[1], array[2]);
printf("\n\t\tAndy: %s\n", array[randNum]);
printf("\t\tSpencer: %s\n\n\n", array[randNum1]);
do{
printf("Do you want to play again?\n1 = Yes\n2 = No\n Your Choice: ");
scanf("%d", &playAgain);
if (playAgain != '1' && playAgain != '2')
printf("Invalid Entry. Please Try Again.\n\n\t");
system ("pause");
}
Errors:
13 C:\Users\Andrew\Desktop\Untitled1.c syntax error before "int"
37 C:\Users\Andrew\Desktop\Untitled1.c syntax error before '[' token
37 C:\Users\Andrew\Desktop\Untitled1.c conflicting types for 'game'
13 C:\Users\Andrew\Desktop\Untitled1.c previous declaration of 'game' was here
37 C:\Users\Andrew\Desktop\Untitled1.c conflicting types for 'game'
13 C:\Users\Andrew\Desktop\Untitled1.c previous declaration of 'game' was here
C:\Users\Andrew\Desktop\Untitled1.c In function `game':
56 C:\Users\Andrew\Desktop\Untitled1.c syntax error at end of input