COS120HomeWork_2 -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
9cec0438f06b0cb489eef0c711983994a9bf1c8e.doc Page 1 of 2 COS120 Software Development Using C++ Student: Homework Nmr 02 (Functions) Tasks: Write a driver program to test user defined function hypotenuse() that calculates the length of the hypotenuse of a right triangle when the other two sides are given. The function should take two arguments of type double and return the hypotenuse as a double . Comment lines to be inserted. Write a driver program to test user defined function instruct() that displays instructions to create a new Win32 Console project. Comment lines to be inserted. First task: /* The program takes as arguments 2 sides of a right triangle * and calculates the hypotenuse */ # include <iostream> # include <cmath> using namespace std; double hypotenuse (double, double); int main(void) { double side1, side2; cout << "Enter the two sides of the triangle: "; cin >> side1 >> side2; cout << "The hypotenuse is: " << hypotenuse(side1, side2); return 0; } double hypotenuse (double side1, double side2)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

COS120HomeWork_2 -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online