|
-
November 7th, 2012, 09:46 AM
#1
Extremely Simple Code, Please Help With ERRORS......
class Book
{
int BNo;
char BName[80];
char BAuth[80];
unsigned int Bcop;
public:
void BInput()
{
cout<<"Book Number: ";cin>>Bno;//Error 1
cout<<"Book Name: ";gets(Bname);
cout<<"Book Author: ";gets(BAuth);
}
void BDisp()
{
cout<<"Book Number: "<<Bno<<endl;
cout<<"Book Name: ";puts(Bname);
cout<<"Book Author: ";puts(BAuth);
}
int BGet_Bno() {return Bno;}
char* BGet_BName() {return &BName;}//Error 2
char* BGet_BAuth() {return &BAuth;}
};
Upon compilation, I am getting multiple errors as:
Error 1:Undefine Symbol Bno
Error 2: Cannot convert char[80] * to char *
Please help me out!!
-
November 7th, 2012, 09:56 AM
#2
Re: Extremely Simple Code, Please Help With ERRORS......
C++ is a case-sensitive language.
-
November 7th, 2012, 10:09 AM
#3
Re: Extremely Simple Code, Please Help With ERRORS......
Thanks a TON for correcting that MOST RIDICULOUS MISTAKE EVER!!
Can you please tell about Error 2 as well?
I am a newbie to this stuff.....
-
November 7th, 2012, 10:16 AM
#4
Re: Extremely Simple Code, Please Help With ERRORS......
If you just refer to an array by name, it is essentially a pointer. So return BName, not &BName.
-
November 7th, 2012, 10:30 AM
#5
Re: Extremely Simple Code, Please Help With ERRORS......
That solved the problem...
Thanks a lot again.....
Its nice to have people like you around....
-
November 7th, 2012, 10:31 AM
#6
Re: Extremely Simple Code, Please Help With ERRORS......
 Originally Posted by aditya.manglik
That solved the problem...
Thanks a lot again.....
Its nice to have people like you around....
You're welcome.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|
Bookmarks