/*********************************************** ** Remy's Circle Equation Calculation Program ** ************************************************/ #include #include #include #include #define PI 3.14 float a; float c; void prompt(void); float area(void); float circ(void); void main() { prompt(); } float area(void) { char rad[20]; float r; float x; gets(rad); r=atoi(rad); x=PI*(r*r); return(x); } float circ(void) { char rad[20]; float r; float x; gets(rad); r=atoi(rad); x=2*PI*r; return(x); } void prompt(void) { printf("Press A for area, C for circumference, and Q to quit.\n"); c=toupper(getch()); if (c=='A') { printf("You chose area.\n"); printf("Enter the radius:"); a=area(); printf("The area of the circle is %f.\n",a); prompt(); } else if (c=='C') { printf("You chose circumference.\n"); printf("Enter the radius:"); c=circ(); printf("The circumference of the circle is %f.\n",c); prompt(); } else if (c=='Q') { printf("Hit any key to close the program.\n"); printf("Good bye!\n"); getch(); } else { printf("Invalid choice.\n"); prompt(); } }