Create the first part of a rock paper scissors game

Assignment Help C/C++ Programming
Reference no: EM13802760

Part 1-

switch

Create the first part of a Rock, Paper, Scissors game.  Tell the user what you are playing and then ask them to choose either rock, paper or scissors.  After they choose tell them what they chose.  If they make an invalid choice, let them know.  You must use a swich statement for this lab.

Your text must exatly match the examples below:

Example 1 with correct input:

Let's play Rock, Paper, Scissors

Enter 1 for rock, 2 for paper, 3 for scissors

2

You chose paper

Example 2 with incorrect input:

Let's play Rock, Paper, Scissors

Enter 1 for rock, 2 for paper, 3 for scissors

5

5 is not a valid choice

Part 2-

Create the second part of a Rock, Paper, Scissors game.  Alter lab 6 so that the user keeps playing as long as they enter in 'Y'.  Make this case sensitve; if they enter in lower case y the game will not continue.  If the user enters in anything besides upper case Y the game will end. 

Your text must exatly match the examples below:

Example 1 with correct input:

Let's play Rock, Paper, Scissors

Enter 1 for rock, 2 for paper, 3 for scissors

2

You chose paper

Would you like to play again (Y for yes, N for no)?

Y

Enter 1 for rock, 2 for paper, 3 for scissors

1

You chose rock

Would you like to play again (Y for yes, N for no)?

N

Example 2 with incorrect input:

Let's play Rock, Paper, Scissors

Enter 1 for rock, 2 for paper, 3 for scissors

5

5 is not a valid choice

Would you like to play again (Y for yes, N for no)?

y

Part 3-

The purpose of this project is to use cin to handle user keyboard inputs, use branching statements to control the flow of a program, and work on your C++ programming style.

You will implement a rock-paper-scissors game. The computer will select rock, paper, or scissors randomly (and of course not reveal this selection to the player). The player will then enter 1 for Rock, 2 for Paper, or 3 for Scissor. The program will let the player know if she or he won. At the end of each round ask the player if she or he wants to play again.

You must implement/include the following features in addition to the game play:

  • Keep count of the number of times the player won and lost -- when the player chooses to stop playing, display these counts
  • Keep a count of the number of times the player selects to play rock, scissors, and paper 
  • Implement the computer's selection as a random integer 

Objectives:

  • Work on your C++ programming style
  • Use boolean expressions
  • Use branching statements to control the flow of a program

Requirements:

  1. Source code is documented correctly with name, lab section, and name of program
  2. Your program source code must be neatly and consistently formatted (use GG=g in vim)
  3. Program compiles and runs without error
  4. Program handles user input with cin
  5. Use at least one (1) switch statement and one (1) if statement
  6. Computer generates an integer random selection
  7. Prompt for and read in the player's selection
  8. Compare the player's selection to the computer's selection
  9. Display an appropriate message to the player to let them know whether they won or lost 
  10. Keep a count of the number of times the player selects to play rock, scissors, and paper
  11. Prompt for and read in the player's choice about playing another round
  12. At the end of play, display the number of player wins and losses

13. Out of all the games played let the player know who was the overall winner (computer or player).  Also what the winning object (what object did the winner have the most wins with).

14. Tell the player what they should have chosen to win most of the time.  For example, if the computer chose rock 7 out of the 10 times then the player should have chosen rock to win most of the time.

part 4- Question 1

1. 1: for(int var=0; var<10; ++var)
2: {
3: cout << "Hi there" << endl;
4: }
5: cout << "After loop ends" << endl;

What is the value of var on line 5?

11

0

9

10

Question 2

1. How many times does this loop iterate?
1: int x = -5;
2: while( x > 4 )
3: {
4: cout << "hi there" << endl;
5: }
6: cout << "done!" << endl;

8

0

1

2

Reference no: EM13802760

Questions Cloud

Define consensus and conflict models of theorizing : difference between the consensus and conflict models of theorizing
What are the four guidelines for a letter of transmittal : What are the four guidelines for a letter of transmittal? Your response should be at least 75 words in length. You are required to use at least your textbook as source material for your response.
What should be included within a reports introduction : What should be included within a reports introduction? Your response should be at least 75 words in length. You are required to use at least your textbook as source material for your response.
What is the main purpose of an executive summary : What is the purpose of an executive summary? Your response should be at least 75 words in length. You are required to use at least your textbook as source material for your response.
Create the first part of a rock paper scissors game : Create the first part of a Rock, Paper, Scissors game.  Tell the user what you are playing and then ask them to choose either rock, paper or scissors.  After they choose tell them what they chose.  If they make an invalid choice, let them know.  Y..
Interviewee’s educational and career development narrative : the interviewee's educational and career development narrative,
What are three visual devices you can use : What are three visual devices you can use to help get the reader's attention, maintain interest, and highlight important information?
Why is revision significant : 1. Why is revision significant? 2. What can get in the way of helpful revision strategies? 3. From your experience, provide a situation where you either sent or received correspondence in which the message was not understood?
Define each of the four common report types : Define each of the four common report types. Your response should be at least 200 words in length. You are required to use at least your textbook as source material for your response.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a function named vowelwords

Write a function named vowelwords(), that reads the file text1.txt and create a new file named text2.txt, which shall contain only those words from the file text1.txt which don’t start with an uppercase vowel(i.e., with ‘A’,’E’,’I’,’O’,’U’)

  Provide public member functions that perform the given task

Provide public member functions that perform the given tasks setComplex function to set complex number to set the real part and imaginary part of the complex number

  You will create a linked list module

You will create a linked list module that exactly meets the specifications given in the supplied header (.h) file. The playlist program must accept a filename on the command line (argv).

  Write a program that prompts for and gets a student name

Write a program that gets 10 numbers and stores then in an array. Then sort (low to high) the number using a function.

  Virus protection program

If you encounter a Trojan Horse what has happened? You read a fake email from a bank that appears to be asking for personal information. Someone has stolen your credit card and used it to purchase items online.

  Write a c program that copies the contents of one file

write a c program that copiest the contents of one file to a destination file. This program works by first prompting the user for the name of the source file and destination file.

  Prepare an arbitrary sinusoidal waveform

Create a program to compute the derivative of an arbitrary input function, with arbitrary duration and arbitrary limits

  Write a program to display the total salary for assistant

Write a program to display the total salary for assistant professors, associate professors, full professors, and all faculties, respectively, and show the average salary for assistant professors, associate professors, full professors, and all facu..

  Multiply a set of complex numbers

Write a C program to multiply a set of complex numbers stored in an array (that has been dynamically allocated). Specifically, first prompt the user to enter how many complex numbers need to be multiplied, dynamically create an array to store the ..

  Write a program that accepts as input a string variable

Write a program that accepts as input a string variable called strFirstName, then another string variable called strLastName, and an integer variable called intAge.

  Write program to declare the array of type float

Write down the c++ program which declares the array of 50 components of type float. Initialize array so that first 25 components are equal to square of the index variable.

  Write a c++ program to calculate the sum

The list of all natural numbers less than 10 that are multiples of 3 or 5 is 3,5,6,9. The sum of these multiples is 23. Write a C++ program to calculate the sum of all such multiples less than 1,000.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd