whats wrong with my codes?? it runs but it doesn't execute the logic inside??
//handles other alphabet and numbers
its a rockpaperscissor game in a windows application form ,must accept S,F,R only and changes the label to who the winner is. Help u.u
private void Form1_KeyPress( Object^ /*sender*/, System::Windows::Forms::KeyPressEventArgs^ e )
{
if ((e->KeyChar>='0' )&&(e->KeyChar>='9' ))
{e->Handled=true;}
int main()//main program
{
char P1 ;//variables for choosing P1
char P2Choice[ 2 ]={'S','P','R'};//array for player2/computer choices
char P2;
//random seed for player2/computer
srand ( time(NULL) ); //initialize the random seed
int RandIndex = rand() % 3; //generates a random number between 0 and 2
P2= P2Choice[RandIndex];
//get choice of player 1
P1 = this->txtbxPlayer1->Text;
this->txtbxPlayer2->Text=P2;
I'm not really sure why you used all of the this-> terms. Instead, I just used cout and cin. I also added a few lines to output player two's choice. Otherwise, you would enter your choice then win or loose without knowing what the other player's choice was. The following code compiled just fine for me: