• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Class programming help needed plz

Status
Not open for further replies.

NiCeBoY

New Member
hello,
i got an assignment whichc onsist of 3 questions.
i was able to do first and second question but the third one i am getting some problems..

i am posting the code and question as image so as they don't appear on search engines as its for uni things...

The answer is a .cpp file. I modified the filename to .c because the forum here does not allow upload of .cpp file.

only these part i think needs to modify:

first:

// --------------------needs mods----

Circle_Shape(){};
Circle_Shape(Point c, double s){
centre = c;
size = s;
};

// ------------
second :

// -----------------needs mods-------

Rec_Shape(){};
Rec_Shape(Point w, double s){
width = w;
size = s;
};

// ------------

Third

cout << rect.area() << endl;
cout << rect.perimeter() << endl;
cout << circ.area() << endl;
cout << circ.perimeter() << endl;
I really need to get this working urgently...

Please when replying don't post the whole code directly on the forum...

send as attachment or just part which you modified...


Thank you very much in advance for your help...
 

Attachments

edeca

Active Member
You will get better answers if you find a forum that specialises in C++. Not many microcontrollers can run C++ code properly.

You will also get better help if you post your answers to the first part of the question, where you have defined the UML diagrams. These feed directly into writing good code.

Hiding your question as an image is questionable though. If you don't want your professor to catch you asking for help on the internet, don't ask for help on the internet :)

Good luck.
 

smanches

New Member
Some hints for you...

Class constructors and destructors need to be named the exact same as the class.
Destructors of base classes should to be virtual.
 

NiCeBoY

New Member
will you be able to fix it and send it back to me please?

i am just a newbie in programming.. and this question is beyond my level...

i was able to get help from books and online resources to write the bit i posted above...
thanks
 

smanches

New Member
Sorry, you have to do your own homework.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top