Heres my code, and all comments are what the errors are, i just don't understand what they're saying...
---------------------------
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
char computerchoice(int y, char playerchoice);
void who_wins(int y, char playerchoice);
int main()
{
int x;
char playerchoice[9];
cout<<"Welcome to my first game!"<<endl;
for(x=0;x<500;x++)
{
cout<<"Please type in rock, paper, or scissors"<<endl<<"and then press enter"<<endl;
cin.getline(playerchoice, '/n');
cout<<"I choose "<<computerchoice<<endl;
void who_wins();
}
return 0;
}
char computerchoice()
{
char compchoice[9];
int y=rand()%4;
switch (y)
{
case 1:
compchoice = "rock "; //'=' : left operand must be l-value
break;
case 2:
compchoice = "paper "; //'=' : left operand must be l-value
break;
case 3:
compchoice = "scissors"; //'=' : left operand must be l-value
break;
}
return compchoice[9];
}
char who_wins(char compchoice, char playerchoice)
{
if (!strcmp(compchoice, "rock ")) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
if (strcmp("rock", playerchoice)<0) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
cout<<endl<<"HAHA, I win!"<<endl;
}
else if(strcmp("rock", playerchoice)>0) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
cout<<endl<<"You got lucky, you lucky bastard..."<<endl;
}
else
{
cout<<endl<<"Let's try this again!"<<endl;
}
}
if (!strcmp("paper", compchoice)) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
if (strcmp("paper ", playerchoice)<0) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
cout<<endl<<"Don't you wish you had mind-reading capabilities like mine???"<<endl;
}
else if (strcmp("paper", playerchoice)>0) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
cout<<endl<<"Ya, I thought I'd throw ya' a bone"<<endl;
}
else
{
cout<<endl<<"This time, just go ahead and try to beat me..."<<endl;
}
}
if (!strcmp("scissors", compchoice)) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
if (strcmp("scissors", playerchoice)<0) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
cout<<endl<<"Man, I ROCK!...heh heh heh...get it? rock...heh heh heh..."<<endl;
}
else if (strcmp("scissors", playerchoice)>0) //'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
{
cout<<endl<<"You keep this up and I'm gonna' send an electric shock through the keyboard."<<endl;
}
else
{
cout<<endl<<"Hey, good job, this is an improvement from your constant losing!"<<endl;
}
}
}
-----------------------
anybody know what's goin on?