C++ warning: control reaches end of nonvoid funtion

I keep getting a C++ warning: control reaches end of nonvoid function on the last two }. Someone please help me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <iomanip>
#include <cmath>
#include <math.h>

using namespace std;

char s = '\0';
const char SENTINEL = 's';

float radius, answer;

void get_radius (float&);
float surface_area (float);
float volume (float);
float cross_section (float);

const float PI = 3.14;

int main()
{
    cout << "This program will let you input the radius of a sphere to find its volume or surface area." << endl << endl;
    cout << "Enter 'v' for volume or 'a' for surface area of a sphere" << endl;
    cout << "'s' to stop" << endl;
    cin >> s;
    while (s != SENTINEL)
    {
        get_radius (radius);
        
        if(s == 'V')
        {
            volume (radius);
        }
        else if(s == 'A')
        {
            surface_area (radius);
        }
        
        cout << "Enter 'v' for volume or 'a' for surface area of a sphere" << endl;
        cout << "'s' to stop" << endl;
        cin >> s;
    }
    
    system("PAUSE");
    return 0;
}
void get_radius (float& radius)
{
    cout << "Please enter the radius of the sphere: " << endl;
    cin >> radius;
}

float volume (float radius){
    float answer;
    answer = 4.0/3.0 * PI * pow (radius, 3);
    cout << "The volume is: " << answer << endl;
}
float surface_area (float radius){
    float answer;
    answer =  4.0 * PI * pow(radius, 2);
    cout << "The surface area is: " << answer << endl;
}
No need to create multiple threads, keep it at
http://www.cplusplus.com/forum/general/165140/
Topic archived. No new replies allowed.