Name your files hw3_<problem>.cpp, such as hw3_1.cpp. Email all the cpp files to my Helios account.
int main() { int num1, num2, num3; double dnum1, dnum2; // Two integer version get_input(num1, num2); print_min(find_min(num1, num2)); // Two double version get_input(dnum1, dnum2); print_min(find_min(dnum1, dnum2)); // Three integer version get_input(num1, num2, num3); print_min(find_min(num1, num2, num3)); return 0; }
Examples of converted time:
Use the following main function:
int main() { int hour, minute; cout << "Enter the hour in 24h format (0-23): "; cin >> hour; cout << "Enter the minute (0-59): "; cin >> minute; print_time(hour, minute); return 0; }
The area of an arbitrary triangle can be computed using the formula area = sqrt( s(s - a)(s - b)(s - c) ), where a, b, and c are the lengths of the sides and s is the semiperimeter. s = (a + b + c)/2. Write a void function that uses five parameters: three value parameters that provide the lengths of the edges, and computes the area and perimeter (not the semiperimeter) via reference parameters. Make your function robust. Note that not all combinations of a, b, c produce a triangle. Your function should produce correct results for legal data and reasonable results for illegal combinations.Making your function "robust" means your function should validate the input (the lengths of the sides) to make sure they form a triangle. A valid triangle is formed when all the sides are greater than 0 and the sum of the lengths of two of the sides is longer than the third side. Should this precondition fail, print an error message and set the area and semiperimeter equal to 0.
Welcome to the CS221 Homework 3 Menu ==================================== 1. Multiply two integers 2. Divide two integers 3. Check if a number is within the range 10-20 4. Find the minimum of a list of 3 numbers 0. Exit ==================================== Enter selection:From within each case statement, there will be a void function that gets the input from the user, does the task and prints the result to the screen. For example, the first menu item case statement would be:
case 1: do_multiply(); break;You should have at least 4 functions in your final code (more is fine if you wish to break each menu item task into subtasks):