Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ 1. Dice Game diceGame.cpp a. Write a program using loops that simulates two players playing a dice game for 11 turns. For each turn,

C++

1.

Dice Game diceGame.cpp

a. Write a program using loops that simulates two players playing a dice game for 11 turns. For each turn, you roll two dices and add up the numbers. When the total is even, player1 gets a point and when it is odd, player2 gets a point. You must keep track of how many points each player gets. At the end you need to determine and display which player won. Use random numbers to generate the dice roll for each turn. Don't forget to seed your random number generator.

Note: This part of your program does not require any user input.

b. Extend your program by using a loop around your game that asks the users whether they want to play again (y or n) and runs the whole game again if they enter y or Y and exits if they press anything else. At the end, you should display how many rounds of games each player won.

2.

Pattern Display patternDisplay.cpp

Write a program that asks the user how many rows of pattern they would like to display and use loops to draw the pattern with the specified number of rows. For example, if the user inputs 5, the pattern would appear as follows:

# *# **# ***# ****#

Input Validation: Do not accept number of rows less than 1 or more than 20. Use nested loops, do not simply display using a single loop and /or cout statements.

3

Numeric Processing using Files numFileProcessing.cpp

I have provided a a file named Random.txt with this project. This file contains a long list of random numbers. Copy the file to your system and make sure it is in the same folder where you save your numProcessing.cpp file. Now, write a C++ program that opens the file, reads all the numbers from the file, and calculates the following:

A. Count the numbers in the file and display the count

B. The sum of all the numbers in the file (a running total)

C. The average of all the numbers in the file

The program should display the count of random numbers found in the file, the sum of the numbers, and the average of the numbers.

Random.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

Define the terms supertype, subtype, and discriminator. AppendixLO1

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago