Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 9 Weeks Ago, 2 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Can you help me with this program, I don't know where to start
Page1of6ITP 165: Introduction to C++ ProgrammingHomework 7: High-card simulatorDue: 11:59pm, March 11th, 2016GoalFor this assignment, you’ll be creating a simulator for an exciting game of High-Card. 2 players randomlypick 2 cards from two different decks. Whoever gets the highest rank (suit doesn’t matter), wins theround. You’ll run the simulator until the user asks for the excitement to stop.SetupCreate a new project in Visual Studio or Xcode calledhw07and a new C++ file namedhw07.cpp.Yourhw07.cppfile must begin with the following (replace the name and email with your actualinformation):// Name// ITP 165, Spring 2016// Homework 07// USC emailPart 1: Struct setupCreate astructcalledCard. It has 2 pieces of data:oAnintto hold the card’s rank – a number from 2 to 14. Where 11 represents a Jack, 12is a Queen, 13 is a King, and 14 is an Ace.oAstd::stringto hold the card’s suit. Suits can be Diamonds, Clubs, Hearts, or Spades.Writemainthat, for now, makes a variable of typeCard, just to test everything.Part 2: cardToString functionCreate a function called “cardToString”. It should accept 1Cardvariable for input and return astd::string. This function will examine the inputted card and generate a string containingsomething like “2 of Clubs” or “Queen of Diamonds”.I recommend creating astd::stringto hold the return value.If the card rank is between 2 and 10, you can set the return value to contain the starting numberlike “5” or “10”.If the card rank is between 11 and 14, you’ll need to decode the rank to Jack, Queen, King, orAce.Next, add the suit of theCardvariable to the return value and return that newstd::string.For now, inside ofmain, create a newCardvariable for testing thecardToStringfunction. Setthe card’s rank and suit to your favorite playing card value.You should be able to display out that card’s information with code similar to:std::cout<<cardToString(testCard) <<std::endl;Be sure to test your function with severalCardvalues/variables.Part 3: makeCard functionCreate a function called “makeCard”. Its job is to createCardvariables for us. It accepts 2 input:
Attachments:-----------