Question
1)In C++ using IF statements write a program Rock, paper, scissors game: Have player one enter 1 for rock, 2 for scissors or 3 for
1)In C++ using IF statements write a program
Rock, paper, scissors game: Have player one enter 1 for rock, 2 for scissors or 3 for paper. Have player 2 do the same. Then, compare the results to decide who wins. (If you are not familiar with the game - rock beats scissors, scissors beats paper, Paper beats rock.) If they choose the same number, they tie.
Player 1 - enter 1 for rock, 2 for scissors or 3 for paper: 1
Player 2 - enter 1 for rock, 2 for scissors or 3 for paper: 3
Player 2 wins!
____________________________________________________________________________________________________________________________________
2)Create a flowchart and psuedocode for the program above.
____________________________________________________________________________________________________________________________________
3)State the order of evaluation of the operators in each of the following C++ statements and show the value of x after each statement is performed.
a) x = 5 + 4 * 9 / 2 - 1;
b) x = 2 % 2 + 2 * 2 - 2 / 2;
c) x = (2 * 8 * (2 + (8 * 2 / (2))));
__________________________________________________________________________________________________________________________________________________________
4)Write another program. In this program you will be asking the user to enter two different numbers. Then, you will take those two numbers and subtract the second number from the first. You will then print out the result. Use unsigned ints.
__________________________________________________________________________________________________________________________________________________________
5)What, if anything, prints when each of the following C++ statements is performed? If nothing prints, then answer "nothing". Assume x = 5 and y = 2. (Don't program this. Just try to figure it out)
std::cout << "x=";
std::cout << y + y;
std::cin >> x >> y;
std::cout << y;
std::cout << "x = " << x;
// std::cout << "x + y = " << x + y;
std::cout << " ";
std::cout << x + y << " = " << y + x;
z = x + y;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started