Playing card with a face value and a suit

Assignment Help Basic Statistics
Reference no: EM13928257

1.

a. Create a Card structure that holds a playing card's face and suit.
struct Card {
string face;
string suit;
};

b. Create a Student structure that holds a first name, last name, and student id.

c. Create a Product structure that holds an item name and price in dollars.

d. Create an Employee structure that holds a full name and a boss(which is are ference to this Employee type).

Note that you might have to look up self--- referencing structures to figure this one out.

2. The Card structure below represents a playing card with a face value and a suit. Using the main code given, set the cards in the deck array to be one of each kind of playing card.

The order doesn't matter.

Set the deck using only one loop.
struct Card {
string face;
string suit;
};
//In main
Card deck[52];
int numFaces = 13;
int numSuits = 4;
string faces[numFaces] = { "Ace", "Two", "Three", "Four",
"Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack",
"Queen", "King" };
string suits[numSuits] = { "Hearts", "Spades", "Diamonds",
"Clubs" };
//Fill deck here

Type aliases

3. What does a type alias do? Does it create a new data type? How do you use an alias after you create it?

4. For each of the following examples, create one type alias using the "typedef" keyword and another using the "using" keyword. The first one is done for you as an example.

a. The type "name" as a string.
typedef string name;
using name = string;

b. The type "student_id" as an unsigned integer.

c. The type "grade" as a pointer to a character.

d. Using the Card structure from the previous question in this homework, create the type "deck" as an array of 52 Cards
(Card[52]).

Pointer Concepts


5. Fill in the blanks of the following statements. You may write them in the blank space under the statements. (4 points each)

A pointer is a variable that contains as its value the _________ of another variable.
The three values you can use to set the pointer to null are__________, ___________, and___________.
c. If you don't initialize a pointer to null, you should set it to ______________________________________________.
The notations used to access values in a sequence in memory are the pointer/________ notation and the pointer/_________ notation.
The sizeof operator determines the size of a type, variable, or constant measured in units of __________.
A pointer---based string ends with a special character called the _____________.

Pointer Practice

6. What does the following code output to the console?

Be sure to format the output exactly as it would appear. There are no errors.

#include <iostream>
using namespace std;
void mystery(int*, int*, size_t);
void printArray(int*, size_t);
int main() {
int numbers1[5] = {1, 2, 3, 4, 5};
int numbers2[5] = {1, 1, 1, 1, 1};
int numbers3[8] = { };
mystery(numbers2, numbers1, 5);
mystery(numbers3 + 3, numbers1, 5);
printArray(numbers1, 5);
printArray(numbers2, 5);
printArray(numbers3, 8);
}
void mystery(int *p1, int *p2, size_t length) {
for(int x = 0; x < length; x++) {
*(p1 + x) += *(p2 + x);
}
}
void printArray(int *p, size_t length) {
for(int x = 0; x < length; x++) {
cout << p[x] << " ";
}
cout << endl;
}

Reference no: EM13928257

Questions Cloud

What is the payback period of the project : Your required rate of return is 8%. If you invest $15,000 today in a project, you will receive the following cash flows: What is the NPV of the project? What is the payback period of the project?
Project with the following projected cash flows : Thompson Industries has a project with the following projected cash flows:
How are emotions linked to memories : Video: https://www.youtube.com/playlist?list=PL35B9B52BF0F4238D. How are emotions linked to memories? Provide some examples to support your answers
What will the WACCs be for each division : Suppose your firm has decided to use a divisional WACC approach to analyze projects. The firm currently has four divisions, A through D, with average betas for each division of 0.9, 1.3, 1.4, and 1.5, respectively. What will the WACCs be for each div..
Playing card with a face value and a suit : The Card structure below represents a playing card with a face value and a suit. Using the main code given, set the cards in the deck array to be one of each kind of playing card.
Calculate net present value of proposed expansion project : Based on its analysis of current conditions in Swiss capital markets, International Foods has determined that the applicable cost of capital for the project is 16 percent. Calculate the net present value of the proposed expansion project.
Forecast for the firm is steady growth over the next decade : You are considering buying shares of stock in the Steel Mill. The forecast for the firm is steady growth over the next decade. The firm just paid its annual dividend of $1.42 per share and has plans to increase that amount by 4 percent annually indef..
Summary of situational analysis : As an existing business Tidmax is a huge international wholesale warehouse that provides it members with quality big box products and low prices.
Preferred stock weight and debt weight : BetterPie Industries has 6 million shares of common stock outstanding, 4 million shares of preferred stock outstanding, and 15,000 bonds. Assume the common shares are selling for $47 per share, the preferred shares are selling for $24.50 per share, a..

Reviews

Write a Review

Basic Statistics Questions & Answers

  Find out the margin of error or standard error

Assume a population standard deviation of 350 kilowatt hours. Determine the standard error of the mean. With a 0.95 probability, determine the margin of error or standard error.

  The number of viewers for the american idol television show

the number of viewers for the american idol television show follows a normal distribution with a mean of 29 million and

  Describe statistical experiment to test the belief

Salaries upon graduating than are graduates of other programs. Describe a statistical experiment that could help test your belief.

  Define fitr-btgi-macrs

Show that the MACRS system is more beneficial economically. Use a 5-year tax life. The corporate MARR is 10%, and the tax rate is 34.

  Wen those 15 valuse are added then didvided by 15 the

a statiscal abstract includes the average per captia income for each of 15 states. when those 15 valuse are added then

  Computing expected return and standard deviation

The annual returns, in percentages, on stocks A and B for three possible states of the economy are given in the table below.

  Let x and y be bernoulli random variables let z x y show

1. let x and y be bernoulli random variables. let z x ya. show that if x and y cannot both be equal to 1 then z is

  Degrees of freedom and conditional expectations

Show that if Z1 and Z2 are independent standard normal random variables, then for all ρ (correlation), Z 1 and ρZ 1 +sqrt(1-ρ 2 )*Z 2 are standard normal with correlation ρ.

  The average monthly rent for a one-bedroom home in san

the average monthly rent for a one-bedroom home in san francisco is 1429. a random sample of 20 one-bedroom homes about

  A student asked to give a class demonstration of the use of

a student asked to give a class demonstration of the use of an ordinary t-statistic confidence interval for comparing

  Find minimum score required to not be directed to retraining

Applicants with exam scores in the lower 10% are directed to special retraining. What is the minimum score required to not be directed to retraining?

  Reported the mean number of man-hours

The company statistician has reported the mean number of man-hours lost per month but did not keep a record of the total sum. Should the manager order the study repeated to obtain the desired information? Explain your answer clearly.

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