can anyone pleas help . How can i ramdomly generate the computer answer.
Code:
/*
*/
#include<stdio.h>
int main ()
{
/*Local Declarations*/
char Player1;
char Player2;
int S;
int R;
int P;
/*Statements*/
printf("Hello Everybody I assume that you know how to play this Game\n");
printf("\n");
printf("Ok! Guys Lets Start !!");
printf("\n");
printf("Instructions:\n");
printf("\n");
printf("If you want to choose Scissor, Type the Capital letter (S)\n");
printf("\n");
printf("Next , If you want to choose Rock, Type the Capital letter (R)\n");
printf("\n");
printf("And Last If you want to pick Paper, Type the Capital letter (P)\n");
printf("\n");
printf("Choose your Weapon:");
scanf("%d%d%d", S, R, P );
if(Player1='S')
{
printf("You choose Scissor");
}
else if (Player1='R')
{
printf("You Choose Rock");
}
else if (Player1='P')
{
printf("You Choose Paper");
}
else
{
printf("Dont try to confuse me, You Cheater :P");
}
return 0;
if (Player2='S')
{
printf("Computer choose Scissor");
}
else if (Player2='R')
{
printf("Computer choose Rock");
}
else if (Player2='P')
{
printf("Computer choose Paper");
}
else
{
printf("Dont confuse me");
}
if (Player1=Player2)
{
printf("You Tied");
}
if (Player1='S')
{
if (Player2='P')
{
printf("Player1 Wins the Game");
}
else if (Player2='R')
{
printf("Player2 Wins the Game");
}
return 0;
}
}