I had a quick question regarding a programming assignment that i'm currently working on. We are currently working on Dynamically Allocated Arrays.
I was able to set my "Book" object to default values / name in my constructor (using strcpy):
Book::Book()
{
strcpy(title, " ");
strcpy(author, " ");
price = 0.00;
}
However, in another function that was given in the assignement (Set function) I was unable to use the strcpy to do the same for the following:
void Book::Set(const char* t, const char* a, Genre g, double p)
{
strcpy(title, *t);
strcpy(author, *a);
type = g;
price = p;
}
My question is, how would I be able to take the information coming through the first "Const char * t" parameter, and set it to my private data char array named title[31] ?
This is my member data for my "Book" class btw:
private:
char title[31]; // may assume title is 30 characters or less
char author[21]; // may assume author name is 20 characters or
Genre type; // enum Genre
double price;
Let me know if I need to clarify anything,
Thanks again!