# C++

## 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).

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’.

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.

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.

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## Diamond Pattern Write a program that displays the following pattern

LANGUAGE: C++ CHALLENGE: Diamond Pattern Write a program that displays the following pattern: * *** ***** ******* ***** *** * Output description: Seven lines of output as follows: The first consists of 3 spaces followed by a star. The second line consists of 2 spaces followed by a 3 stars. The third consists of one space followed…

Read More## Land Calculation One acre of land is equivalent to 43,560 square feet. Write a program that calculates the number of acres in a tract of land with 389,767 square feet.

LANGUAGE: C++ CHALLENGE: Land Calculation One acre of land is equivalent to 43,560 square feet. Write a program that calculates the number of acres in a tract of land with 389,767 square feet.

Read More## Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.

LANGUAGE: C++ CHALLENGE: Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates , it prints out the sum of all the even integers read, the sum of all the odd integers read, a count of the number of even…

Read More## Given a two-dimensional array of integers named q, with 2 rows and 4 columns, write some code that puts a zero in every element of q.

LANGUAGE: C++ CHALLENGE: Given a two-dimensional array of integers named q, with 2 rows and 4 columns, write some code that puts a zero in every element of q. Declare any variables needed to help you.

Read More## You are given a 6×8 (6 rows, 8 columns) array of integers , x, already initialized and three integer variables : max, i and j.

LANGUAGE: C++ CHALLENGE: You are given a 6×8 (6 rows, 8 columns) array of integers , x, already initialized and three integer variables : max, i and j. Write the necessary code so that max will have the largest value in the array x.

Read More## Given an array arr of type int , along with two int variables i and j, write some code that swaps the values of arr[i] and arr[j]. Declare any additional variables as necessary.

LANGUAGE: C++ CHALLENGE: Given an array arr of type int , along with two int variables i and j, write some code that swaps the values of arr[i] and arr[j]. Declare any additional variables as necessary.

Read More## Given a type Money that is a structured type with two int fields, dollars and cents declare an array monthlySales with 12 elements of type Money.

LANGUAGE: C++ CHALLENGE: Given a type Money that is a structured type with two int fields, dollars and cents declare an array monthlySales with 12 elements of type Money.

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).

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