Help on code!

Im supposed to create an to array of eight Circle objects initialized with the radii which is in the program. Also I must use bubble sort to arrange the objects is ascending order. Please help!

ERRORS:
'initializing' : cannot convert from 'double' to 'Circle'
'setRadius' : is not a member of 'Circle'
see declaration of 'Circle'
'findArea' : is not a member of 'Circle'
see declaration of 'Circle

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
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;

class Circle
{
public:
Circle();
};

//Function prototype
void bubbleSort( Circle array[], int);

const int NUM_CIRCLES = 8;

int main()
{ 
Circle circle[NUM_CIRCLES] = {2.5, 4.0, 1.0, 3.0, 6.0, 5.5, 3.5, 2.0 };

for (int index = 0; index < NUM_CIRCLES; index++)
{
double r;
cout <<"The radius for circle" << (index+1) << ": ";
circle[index].setRadius(r);
}


cout << fixed << showpoint << setprecision(2);
cout <<"\nHere are the area of the " << NUM_CIRCLES
 << " cricles.\n";
for (int index = 0; index < NUM_CIRCLES; index++)
{
cout << "circle " << (index+1) << setw(8)
 << circle[index].findArea() << endl;
}

return 0;
}
The error are pretty self-explanatory. You didn't define any members for Circle other than the constructor, which you made take no parameters, forbidding the kind of initialization you used on line 19.
Topic archived. No new replies allowed.