Back To C++ User Defined Functions Index
//program to create two functions to calculate area and circumference of circle and call them based on user choice using switch statement #include
#include
void area(int); void circumference(int); void area(int radius) { float ar; ar=3.14*radius*radius; cout<<"area of circle is "<
>r; cout<<"enter your choice (1 for area and 2 for circumference"; cin>>ch; switch(ch) { case 1:area(r); break; case 2:circumference(r); break; default:cout<<"enter 1 or 2 as choice"; } getch(); }