Arrays With Pointers!!

Could someone please help me with this project. I have to have it turned in by Sunday August 12th. This is where I am so far. This is the original Resistor class
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
//resistor.h
 
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

//The Class Declaration

class ResistorClass {
	
private:
	double m_dResValue;
	double m_dTolerance;
	double m_dMinResistance;
	double m_dMaxResistance;
public:
	string m_cResistorName;
	void DisplayResistor(void);
	void EnterResistance (void);
	void AddSeries(ResistorClass Resistor1, ResistorClass Resistor2);
	//constructors
	ResistorClass();
	ResistorClass(string Name, double resistorValue, double resistorTolerance);
	ResistorClass(const ResistorClass &resistorObject);
	~ResistorClass();
	};



http://pastebin.com/wrwN7S87
Following your link, I see you're having compile problems. However, the code in your link is much different than the code here, so it's not clear how to help. We try not to do homework for other people here. Can you be more specific about whats going wrong?
The code here is the original class. I am suppose to redesign the code so that I am using pointers.

1. Create an array of pointers of type Resistor.

2. Use elements of the pointer array to allow the user to dynamically allocate memory and to instantiate objects of the Resistor class.

3. Use the indirect member-selection operator (pointer) in the test routine to access function members of the Resistor class.

4. Write a new, non class function called in function main() to sort the pointers to the Resistor objects in order from lowest nominal resistance value to highest, passing a pointer to the Resistor-object pointer as the only passed data argument.

5. Display the sorted Resistor objects according to the nominal resistance value, from lowest to highest.

6. Within the sorting function, use pointer arithmetic to access the individual Resistor objects.

7. Function main() should also ensure that there are no memory leaks when the program ends.

I am not asking you to do my homework but I am just beginning and I would like some help.
Last edited on
Topic archived. No new replies allowed.