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

  Statistics-probability assignment

MATH1550H: Assignment:  Question:  A word is selected at random from the following poem of Persian poet and mathematician Omar Khayyam (1048-1131), translated by English poet Edward Fitzgerald (1808-1883). Find the expected value of the length of th..

  What is the least number

MATH1550H: Assignment:  Question:     what is the least number of applicants that should be interviewed so as to have at least 50% chance of finding one such secretary?

  Determine the value of k

MATH1550H: Assignment:  Question:     Experience shows that X, the number of customers entering a post office during any period of time t, is a random variable the probability mass function of which is of the form

  What is the probability

MATH1550H: Assignment:Questions: (Genetics) What is the probability that at most two of the offspring are aa?

  Binomial distributions

MATH1550H: Assignment:  Questions:  Let’s assume the department of Mathematics of Trent University has 11 faculty members. For i = 0; 1; 2; 3; find pi, the probability that i of them were born on Canada Day using the binomial distributions.

  Caselet on mcdonald’s vs. burger king - waiting time

Caselet on McDonald’s vs. Burger King - Waiting time

  Generate descriptive statistics

Generate descriptive statistics. Create a stem-and-leaf plot of the data and box plot of the data.

  Sampling variability and standard error

Problems on Sampling Variability and Standard Error and Confidence Intervals

  Estimate the population mean

Estimate the population mean

  Conduct a marketing experiment

Conduct a marketing experiment in which students are to taste one of two different brands of soft drink

  Find out the probability

Find out the probability

  Linear programming models

LINEAR PROGRAMMING MODELS

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