Uploaded by Prakash Sapkota

2nd assignment

advertisement
1st part
{
Int uChoice, cChoice;
2nd part
String input;
Write(“Please enter 1(rock), 2(paper), or 3(scissors): “);
Input = ReadLine();
uChoice = int.Parse(input);
3rd part
Random ranGen = new Random();
cChoice = ranGen.Next(1, 4);
WriteLine (“User’s pick “ + uChoice + “ Computer’s pick 4th part
If(uChoice == cChoice)
{
WriteLine(“No winner!”);
}
Else if(uChoice == 1 && cChoice == 3 )
{
WriteLine(“User is the winner!”);
}
Else if(uChoice == 2 && cChoice == 1)
{
WriteLine(“User is the winner!”);
}
Else if(uChoice == 3 && cChoice == 2)
{
WriteLine(“User is the winner!”);
}
Else
{
WriteLine(“User is the winner!”);
}
Readkey ();
}
Download