I'm having a problem with this C Programming activity. I'm new to C-Programming and would really like to ask you guys for your help. So please bear with me.
So here's the problem...
When I run the program as I enter my choice for Player Two the program automatically stops and closes. It wont even let me press "ENTER" before it closes. I tried everything else I can and looked for a solution online but to no avail. I am only allowed to use the conditional statement If-Else for this. I would really appreciate any suggestions. Thanks in advance.
#include<stdio.h>
#include<conio.h>
void main(){
clrscr();
char one, two;
printf("\t\t\t Rock-Paper-Scissors\n");
printf("Choose from the following:\n");
printf("r for Rock\np for Paper\ns for Scissors\n\n");
printf("Player One enter your choice: ");
scanf("%c",&one);
printf("Player Two enter your choice: ");
scanf("%c",&two);
printf("\n");
//rock over scissors
if (one == 'r' && two == 's'){
printf("Rock Destroys Scissors\n");
printf("Player One Wins!");
}
else if (two == 'r' && one == 's'){
printf("Rock Destroys Scissors\n");
printf("Player Two Wins!");
}
//paper over rock
else if (one == 'p' && two == 'r'){
printf("Paper Covers Rock\n");
printf("Player One Wins!");
}
else if (two == 'p' && one == 'r'){
printf("Paper Covers Rock\n");
printf("Player Two Wins!");
}
//scissors over paper
else if (one == 's' && two == 'p'){
printf("Scissors Cut Paper\n");
printf("Player One Wins!");
}
else if (two == 's' && one == 'p'){
printf("Scissors Cut Paper\n");
printf("Player Two Wins!");
}
else
printf("It's a Tie!");
getch();
}