31.1k views
1 vote
Instructions { if ( isspace (c)){ Write a program to test the functions described in Exercises 11 and_14_of this chapter. // isapace() is a built-in function that checks for whitespace characters Instructions for Exercise 11 and Exercise 14 have been posted below for your convenience. cout & "The character you entered is a whitespace character" < endl; return true; } Exercise 11 else { cout & "The character you entered is not a whitespace character" < endl; Write the definition of a function that takes as input a char value, and returns true if the return false; character is a whitespace character; otherwise it returns false. } 4} If the character is a whitespace character, output the following message: The character you entered is a whitespace character, otherwise output: The character you entered is not a whitespace character. 17 if (f1 oor ( numl ∗ num2 2)==f100r( num3 )){ 18 return true; 19} Exercise 14 20 else { Write the definition of a function that takes as input three numbers. The function returns true if the floor of the product of the first two numbers equals the floor of the third number; otherwise it returns false. (Assume that the three numbers are of type double.) Output the appropriate message: The product of the first two numbers is not equal to the floor of the third number

1 Answer

2 votes

Final answer:

Two functions are provided: one to check if a character is whitespace and another to compare the floor of the product of two numbers to the floor of a third number, along with appropriate messages depending on the outcomes.

Step-by-step explanation:

The task is to write a program that tests whether a given character is a whitespace and whether the floor of the product of two numbers is equal to the floor of a third number. I will provide two functions based on the descriptions provided in the question. The first function checks for whitespace characters, and the second function compares the floor of the product of two numbers with the floor of a third number.


Function to Check for Whitespace

To check if a given character is a whitespace, we can use the built-in function isspace(). The function returns true if the character is a whitespace; otherwise, it returns false. If the character is a whitespace, we output "The character you entered is a whitespace character"; otherwise, we output "The character you entered is not a whitespace character".


Function to Compare Floor Values

The second function takes three double values as input. It returns true if the floor of the product of the first two numbers equals the floor of the third number. A message indicating whether the products are equal or not will be displayed based on the result.

User Ruzbeh Irani
by
8.6k points