Category: C++

Assume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter. So, pass oneMore(12 ) and it will return 13.

Assume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter. So, pass oneMore(12 ) and it will return 13.

LANGUAGE: C++ CHALLENGE: Assume the availability of a function named oneMore. This function receives an integer and returns one more than its parameter. So, pass oneMore(12 ) and it will return 13. DO NOT DEFINE this function– just assume it is available. YOUR TASK: write an expression whose value is 5 but in your expression you can […]

Read More

Assume that two parallel arrays have been declared and initialized: healthOption an array of type char that contains letter codes for different healthcare options and annualCost an array of type int.

Assume that two parallel arrays have been declared and initialized: healthOption an array of type  char that contains letter codes for different healthcare options and annualCost an array of type int.

LANGUAGE: C++ CHALLENGE: Assume that two parallel arrays have been declared and initialized: healthOption an array of type char that contains letter codes for different healthcare options and annualCost an array of type int. The i-th element of annualCost indicates the annual cost of the i-th element of healthOption. In addition, there is an char […]

Read More

Write the definition of a function named fscopy that does a line-by-line copy from one stream to another.

1
Write the definition of a function named fscopy that does a line-by-line copy from one stream to another.

LANGUAGE: C++ CHALLENGE: Write the definition of a function named fscopy that does a line-by-line copy from one stream to another. This function can be safely passed two fstream objects, one opened for reading, the other for writing. In addition, it gets a bool argument that is true if the output lines are to be […]

Read More

Project 18: Broken Keypad. The keypad on your oven is used to enter the desired baking temperature and is arranged like the digits on a phone

Project 18: Broken Keypad. The keypad on your oven is used to enter the desired baking temperature and is arranged like the digits on a phone

LANGUAGE: Java CHALLENGE: Project 18: Broken Keypad. The keypad on your oven is used to enter the desired baking temperature and is arranged like the digits on a phone: 123 456 789 0 Unfortunately the circuitry is damaged and the digits in the leftmost column no longer function. In other words, the digits 1, 4, […]

Read More

Consider this data sequence: “3 11 5 5 5 2 4 6 6 7 3 -8”. Any value that is the same as the immediately preceding value is considered a CONSECUTIVE DUPLICATE.

Consider this data sequence: “3 11 5 5 5 2 4 6 6 7 3 -8”. Any value that is the same as the immediately preceding value is considered a CONSECUTIVE DUPLICATE.

LANGUAGE: Java CHALLENGE: Consider this data sequence: “3 11 5 5 5 2 4 6 6 7 3 -8”. Any value that is the same as the immediately preceding value is considered a CONSECUTIVE DUPLICATE. In this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. Note that […]

Read More

Declare an fstream object named a_log. Using a_log, check if the file activityLog exists. If the file activityLog does not already exist, open it for writing using a_log; otherwise open the file activityLog2 for writing using a_log.

Declare an fstream object named a_log. Using a_log, check if the file activityLog exists. If the file activityLog does not already exist, open it for writing using a_log; otherwise open the file activityLog2 for writing using a_log.

LANGUAGE: C++ CHALLENGE: Declare an fstream object named a_log. Using a_log, check if the file activityLog exists. If the file activityLog does not already exist, open it for writing using a_log; otherwise open the file activityLog2 for writing using a_log.

Read More

Write the definition of a function square, which receives an integer parameter and returns the square of the value of the parameter.

Write the definition of a function square, which receives an integer parameter and returns the square of the value of the parameter.

LANGUAGE: C++ CHALLENGE: Write the definition of a function square, which receives an integer parameter and returns the square of the value of the parameter. So if the parameter ‘s value is 7, the function returns the value 49. If the parameter ‘s value happens to be 25, the functions returns the value 625. If […]

Read More

Write the definition of a function half, which receives an integer parameter and returns an integer that is half the value of the parameter.

Write the definition of a function half, which receives an integer parameter and returns an integer that is half the value  of the parameter.

LANGUAGE: C++ CHALLENGE: Write the definition of a function half, which receives an integer parameter and returns an integer that is half the value of the parameter. (Use integer division!) So if the parameter’s value is 7, the function returns the value 3. If the parameter’s value happens to be 44, the functions returns the […]

Read More