Debug Help

Any help debugging this code would be great!

#include<iostream.h>
#include<conio.h>
class Dress
 {
  private:
   char material[20];
   int size;
   char style[10];
   double price;

  public:
    Dress(const char mtrl[] = "cotton",const char stl[] = "daytime");
    void displayDress();
  };
Dress::Dress(char mtrl[], int sz, char stl[])
{
  strcpy(material,mtrl);
  strcoy(size,sz);
  strcpy(style,stl);
  price = 29.99;
  if(strcmp(material,"silk") == 0)
    price += 20.00;
  if(strcmp(style, "evening")==0)
    price += 40.00;
 }

void Dress::displayDress()
 {
   cout<<"A size "<<size<<" dress made of "<<material<<" and suitable for "<<
        style<<" wear costs $"<<price<<endl;
  }

void main()
  {
     cout<<"Dress sale! $29.99. Only $20 more for silk. Only $40 more for evening designs."<<endl;
      Dress dressA, dressB("wool"), dressC("silk",14,"evening"),
           dressD("denim",4,"casual"),dressE("silk",8,"business");
     dressA.displayDress();
     dressB.displayDress();
     dressC.displayDress();
     dressD.displayDress();
     dressE.displayDress();
     getch();
  }
KimHopperAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ruff_ryderConnect With a Mentor Commented:
The error:

no overload function takes 3 parameters

relates to your code in main() where you are attempting to call the Dress constructor with 3 arguments as against the 2 that it expects.

0
 
AxterCommented:
What specifically do you need debugged?

What's the problem?
0
 
KimHopperAuthor Commented:
When I compile the code, I have 4 errors which states "no overload function takes 3 parameters"  I am unsure what to do with that
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
jkrCommented:
Axter, like http://www.experts-exchange.com/cplusprog/Q.20288159.html (huh, another Kim?), I guess this is homework - the coding styles are too similar, and the task may have been "what is wrong with this code, as because of " strcoy(size,sz);" (an 'int'!!) it won't even compile, not to speak of "debugging"...
0
 
KimZeeripCommented:
How do I fix this error?
0
 
jkrCommented:
From: KimHopper  Date: 04/12/2002 11:50AM PST  
When I compile the code, I have 4 errors which states "no overload function takes 3 parameters"  I am
unsure what to do with that  

From: KimZeerip  Date: 04/12/2002 12:55PM PST  
How do I fix this error?  


Ouch. Double accounts. I was hoping that I was wrong...
0
 
ruff_ryderCommented:
Do a bit of reading on Classes and handling functions in C++ KimZeerip/KimHopper. This is basic knowledge you must have to proceed in this language.

Look at your code ... you have the following:

Dress(const char mtrl[] = "cotton",const char stl[] = "daytime");

// ....

Dress::Dress(char mtrl[], int sz, char stl[])
{
  ...
}

See the difference??
0
 
KimZeeripCommented:
Are you saying that the
int sz
has to be in the following line as well?:

 Dress(const char mtrl[] = "cotton",const char stl[] = "daytime");
0
 
ruff_ryderCommented:
yep yep.

Dress(const char mtrl[] = "cotton",const char stl[] = "daytime");

the above is your class declaration of the Dress COnstructor.


This code blow is your implementation of the Dress constructor. The signature of the Dress Constructor must be the same in the both the declaration and definition of the Constructor.

Dress::Dress(char mtrl[], int sz, char stl[])
{
 ...
}


As I said before though, do some reading.
0
 
griesshCommented:
Dear KimHopper

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "ruff_ryder"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
MindphaserCommented:
Force accepted

** Mindphaser - Community Support Moderator **
0
All Courses

From novice to tech pro — start learning today.