fork download
  1. #include <iostream>
  2. #include <time.h>
  3. #include <vector>
  4.  
  5. //void menuDisp();
  6. double circum(double);
  7.  
  8. using namespace std;
  9. int main(){
  10.  
  11. //srand(time(NULL));
  12. //int x= (rand()%5)+1;
  13. //cout << x;
  14.  
  15. //menuDisp();
  16.  
  17. double rad=0;
  18. double circumference=0;
  19. cout << "\nEnter a value for the radius: ";
  20. cin >> rad;
  21.  
  22. circumference = circum(rad);
  23. cout << "\n The circumference of the circle is: " << circumference << endl;
  24.  
  25.  
  26. return 0;
  27. }
  28.  
  29. //void menuDisp(){
  30. // std::cout << "\nWelcome to the tutorial, press 1 for bacon: ";
  31. //}
  32.  
  33. double circum (double radius){
  34. double pi = 3.1415;
  35. double circumf =(2*radius)* pi;
  36. return circumf;
  37. }
  38.  
Success #stdin #stdout 0s 2860KB
stdin
5
stdout
Enter a value for the radius: 
 The circumference of the circle is: 31.415