The class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day of the month (1-31), and a year (in that order).

C++

LANGUAGE: C++ CHALLENGE: The class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day of the month (1-31), and a year (in that order). Given the Date variable datep, dynamically allocate a Date object with the initial value of March 12, 2006, and assign…

Read More

Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is the last character of the value of name. So if the value of name were “Blair” the expression’s value would be ‘r’.

C++

LANGUAGE: C++ CHALLENGE: Assume that name is a variable of type string that has been assigned a value. Write an expression whose value is the last character of the value of name. So if the value of name were “Blair” the expression’s value would be ‘r’.

Read More

In mathematics, the Nth harmonic number is defined to be 1 + 1/2 + 1/3 + 1/4 + … + 1/N. So, the first harmonic number is 1, the second is 1.5, the third is 1.83333… and so on.

C++

LANGUAGE: C++ CHALLENGE: In mathematics, the Nth harmonic number is defined to be 1 + 1/2 + 1/3 + 1/4 + … + 1/N. So, the first harmonic number is 1, the second is 1.5, the third is 1.83333… and so on. Assume that n is an integer variable whose value is some integer N greater…

Read More

The dimensions (width and length) of room1 have been read into two variables: width1 and length1. The dimensions of room2 have been read into two other variables: width2 and length2. Write a single expression whose value is the total area of the two rooms.

C++

LANGUAGE: C++ CHALLENGE: The dimensions (width and length) of room1 have been read into two variables: width1 and length1. The dimensions of room2 have been read into two other variables: width2 and length2. Write a single expression whose value is the total area of the two rooms.

Read More

Write a single statement that assigns a new value to the element of the array indexed by j. This new value should be equal to twice the value stored in the next element of the array (i.e. the element after the element indexed by j).

C++

LANGUAGE: C++ CHALLENGE: An array of int named a that contains exactly five elements has already been declared and initialized . In addition, an int variable j has also been declared and initialized to a value somewhere between 0 and 3. Write a single statement that assigns a new value to the element of the array…

Read More