Functions

This program illustrates a menu driven program. One way to organize a program is to have main not much more than calls to other functions.

CODE

Output:

Enter c for circle
Enter s for square
Enter r for rectangle
Enter q to end
Enter choice:s
Enter the side of the square:8
The area is 64.0
Enter choice:c
Enter the radius of the circle:1.5
The area is 7.0649999999999995
Enter choice:r
Enter the width of the rectangle:2.8
Enter the length of the rectangle:4.1
The area is 11.479999999999999
Enter choice:q

NEXT: Arrays