Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Programming Exercise 6.8 The Game Of War, V.1.0 1. 2. 3. Purpose. Write a simple program from scratch that uses if-logio. The game is

image text in transcribedc++
Programming Exercise 6.8 The Game Of War, V.1.0 1. 2. 3. Purpose. Write a simple program from scratch that uses if-logio. The game is played between the computer and a human player Supplemental . Read about "randomizing in www.rdb3.com/epplexercises/Gaming supplemental pat. Requirements. Write the program wari.cpp, based on the card game war (www.pagat.com/war/war.htm), following this algorithm: Algorithm. Call srand Compute and store the computer's card's value (2-14) using the random number generator Output the computer's card's value, outputting 2-10 as that value, but output 11 as Jack, 12 as Queen, 13 as King, and 14 as Ace Get and store the computer's card's suit (0-3) using the random number generator 5. Output the computer's card's suit, but output o as Spades, 1 as Diamonds, 2 as Hearts, and 3 as clubs 6. Get and store the human's card's value (2-14) using the random number generator 7. Output the human's card's value, outputting 2-10 as that value, but output 11 as Jack, 12 as Queen, 13 as King, and 14 as Ace 8. Get and store the human's card's suit (0-3) using the random number generator 9. Output the human's card's suit, but output 0 as Spades, 1 as Diamonds, 2 as Hearts, and 3 as Clubs 10. If the computer's card's value is less than the human's card's value, output "Human wins!" 11. If the computer's card's value is EQUAL TO the human's card's value, output "It's a tie. 12. If the computer's card's value is GREATER than the human's card's value, output "Computer wins

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

Step: 3

blur-text-image

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago