Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Statistics and Probability Expert

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
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;
}

Statistics and Probability, Statistics

  • Category:- Statistics and Probability
  • Reference No.:- M91601137
  • Price:- $15

Priced at Now at $15, Verified Solution

Have any Question?


Related Questions in Statistics and Probability

Inbspa statistics instructor wants to measure the

I. A statistics instructor wants to measure the effectiveness of his teaching skills in a class of 66 students ( N  = 66). He selects students by waiting at the door to the classroom prior to his lecture and pulling asid ...

One season the average little league baseball game averaged

One? season, the average little league baseball game averaged 2 hours and 54 minutes ?(174 ?minutes) to complete. Assume the length of games follows the normal distribution with a standard deviation of 10 minutes. Comple ...

Explain how the company newmans own brand fulfills the

Explain how the company Newman's Own brand fulfills the definition of a business for profit and a non-profit business at the same time. Consider in the response the functions of business, entrepreneurship and production ...

Youre trying to find out how many students who graduate

You're trying to find out how many students who graduate with accounting degrees from large universities are employed at graduation. You design an experiment where you collect information on several variables from recent ...

Suppose a sampling space has things a b and c twice draw

Suppose a sampling space has things a, b, and c. Twice draw from the sample space and replace. The possible sequence formed are {aa,ab,ac,ba,bb,bc,cacb,cc}. Now suppose there are Y different things. There are Y ways the ...

Based on the 1990 census the number of hours per day adults

Based on the 1990 census, the number of hours per day adults spend watching television is approximately normally distributed with a mean of 5 hours and a standard deviation of 1.3 hours. What proportion of the population ...

According to national data about 14 of american college

According to national data, about 14% of American college students earn a graduate degree. Using this estimate, what is the probability that exactly 24 undergraduates in a random sample of 200 students will earn a colleg ...

Twelve different video games showing substance use were

Twelve different video games showing substance use were observed and the duration of times of game play? (in seconds) are listed below. The design of the study justifies the assumption that the sample can be treated as a ...

A coin is randomly picked from a collection of 10 coins the

A coin is randomly picked from a collection of 10 coins, the ith coin having a probabiliity i/10 of coming up heads. The coin in then flipped repeatedly until a head appears. Let X be the number of flips necessary. Find ...

The mean height of women in a country ages 20-29

The mean height of women in a country? (ages 20-?29) is 63.5 inches. A random sample of 65 women in this age group is selected. What is the probability that the mean height for the sample is greater than 64 ?inches? Assu ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As