I cut out the code that doesn't interact with this stuff.
I'm really lost, I don't know what's going on with this stuff.
1>c:\documents and settings\sean\desktop\project1\project1\invmenu.cp p(75) : error C2664: 'BookData::SetISBN' : cannot convert parameter 1 from 'BookData' to 'std::string &'
INVMENU.H
#ifndef INVMENU_H
#define INVMENU_H
#include <iostream>
#include <string>
#include <iomanip>
#include "BookData.h"
void invmenu(BookData books[]);
#endif
------------------------------------
INVMENU.CPP
#include "BookData.h"
#include "invmenu.h"
void lookup();
void addbook();
void lookup()
{
system("cls");
string ISBN;
BookData isbn;
cout << "Serendipity Booksellers\n";
cout << "Book information";
cout << "Please enter ISBN: ";
cin.ignore();
getline(cin, ISBN);
isbn.SetISBN(isbn);
cout << &BookData::GetISBN;
// BookData::SetTitle();
// BookData::SetAuthor();
// BookData::GetPublisher();
// BookData::GetDateadd();
// BookData::GetOnhand();
// BookData::GetWholepri();
// BookData::GetRetPri();
}
---------------------------------------
#ifndef BOOKDATA_H
#define BOOKDATA_H
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
class BookData
{
private:
string title, isbn, author, publisher, dateadded;
double onhand, wholepri, retpri;
public:
string GetTitle();
void SetTitle(string& s);
string GetISBN();
void SetISBN(string& n);
string GetAuthor();
void SetAuthor(string& a);
string GetPublisher();
void SetPublisher(string& p);
string GetDateadd();
void SetDateadd(string& d);
double GetOnhand();
void SetOnhand(double& o);
double GetWholepri();
void SetWholepri(double& w);
double GetRetpri();
void SetRetpri(double r);
};
#endif
---------------------------------------------------------
//Inventory menu
#include "BookData.h"
void bookmenu()
{
cout << "Serendipity Booksellers\n";
cout << "Book Information\n";
}
//Book's Title
string BookData::GetTitle()
{
return title;
}
void BookData::SetTitle(string& s)
{
cin.ignore();
cout << "\nBook's Title: ";
getline(cin, s);
}
//Book's ISBN
string BookData::GetISBN()
{
return isbn;
}
void BookData::SetISBN(string& n)
{
isbn = n;
}
----------------------------------------------------------
I've re-read the class chapter of my book about 5 times now, and I can't figure out where I'm going wrong.
Any help would be greatly appreciated, since I've been stuck at this point for far longer than I should have been.
3 3769
I cut out the code that doesn't interact with this stuff.
I'm really lost, I don't know what's going on with this stuff.
1>c:\documents and settings\sean\desktop\project1\project1\invmenu.cp p(75) : error C2664: 'BookData::SetISBN' : cannot convert parameter 1 from 'BookData' to 'std::string &'
INVMENU.H
#ifndef INVMENU_H
#define INVMENU_H
#include <iostream>
#include <string>
#include <iomanip>
#include "BookData.h"
void invmenu(BookData books[]);
#endif
------------------------------------
INVMENU.CPP
#include "BookData.h"
#include "invmenu.h"
void lookup();
void addbook();
void lookup()
{
system("cls");
string ISBN;
BookData isbn;
cout << "Serendipity Booksellers\n";
cout << "Book information";
cout << "Please enter ISBN: ";
cin.ignore();
getline(cin, ISBN);
isbn.SetISBN(isbn);
cout << &BookData::GetISBN;
// BookData::SetTitle();
// BookData::SetAuthor();
// BookData::GetPublisher();
// BookData::GetDateadd();
// BookData::GetOnhand();
// BookData::GetWholepri();
// BookData::GetRetPri();
}
---------------------------------------
#ifndef BOOKDATA_H
#define BOOKDATA_H
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
class BookData
{
private:
string title, isbn, author, publisher, dateadded;
double onhand, wholepri, retpri;
public:
string GetTitle();
void SetTitle(string& s);
string GetISBN();
void SetISBN(string& n);
string GetAuthor();
void SetAuthor(string& a);
string GetPublisher();
void SetPublisher(string& p);
string GetDateadd();
void SetDateadd(string& d);
double GetOnhand();
void SetOnhand(double& o);
double GetWholepri();
void SetWholepri(double& w);
double GetRetpri();
void SetRetpri(double r);
};
#endif
---------------------------------------------------------
//Inventory menu
#include "BookData.h"
void bookmenu()
{
cout << "Serendipity Booksellers\n";
cout << "Book Information\n";
}
//Book's Title
string BookData::GetTitle()
{
return title;
}
void BookData::SetTitle(string& s)
{
cin.ignore();
cout << "\nBook's Title: ";
getline(cin, s);
}
//Book's ISBN
string BookData::GetISBN()
{
return isbn;
}
void BookData::SetISBN(string& n)
{
isbn = n;
}
----------------------------------------------------------
I've re-read the class chapter of my book about 5 times now, and I can't figure out where I'm going wrong.
Any help would be greatly appreciated, since I've been stuck at this point for far longer than I should have been.
I saw a
somewhere, and there is a private member isbn in ur BookData class as well. U better check it.
In your main() function, you read an ISBN number (as a string) into the variable ISBN, but you also have a BookData object named isbn, which is likely causing you some confusion. When you call SetISBN, you are passing it isbn, which is the BookData object, rather than the string ISBN. You should probably pick better names for your variables.
string ISBN;
BookData isbn;
note that variables are not case-sensitive. You better change the vairable names
like
string sISBN;
BookData objISBN;
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Phil Powell |
last post by:
select event_date, event_name, event_text, event_is_public,
event_is_reserved, event_img_path, event_img_alt, event_member_id,
event_is_email_notify from event where show_entry = '1' and...
|
by: C.O.Jones |
last post by:
Using Oracle 8.1.7 Personal edition on Windows XP.
I was experimenting with the DBA tools. I first of all tried to adjust the
memory used by my database. Then I attempted to shutdown and...
|
by: Gernot Frisch |
last post by:
Hi,
I get these errors, but I'm totally lost. It's a large cpp file and I
don't know where to search for the error, since it does not point to
any of my code lines. Can someone suggest where to...
|
by: Serious_Practitioner |
last post by:
Hello, all -
A few days ago, I posted the following message -
Hello all, and thank you for your help in the recent past.
Got a new error message in the last few days.
While working with...
|
by: Serious_Practitioner |
last post by:
Good day -
As you suggested, I got and used the right version of Jetcomp, and I also
tried to run compact and repair a couple of times. I think that the compact
and repair process doesn't fully...
|
by: jennyq |
last post by:
hi all,
I am just playing with the event sink sample on MSDN, but I found when I
create the instance in VB client, there is an error saying "method
'myButton' of object 'form1'failed, errorcode is...
|
by: Marcel Boscher |
last post by:
Hey guys,
i got a question that bothers me quite a while,
been looking everywhere but found no answer
My idea is to automate this procedure for better performance...
Can anybody in here...
|
by: Alan |
last post by:
Hi
Have asked before elsewhere but think I will have to rephrase the question.
Using MS Access, what's the best way of tackling dates if I want to list all
say; birthdays/birthdates in a date...
|
by: belovah |
last post by:
Hey!!
Can anyone please tell me what's wrong with this line. I'm totally lost
:s
Error:
Parse error: parse error, unexpected '.' in
C:\Server\www\4images\includes\functions.php on line 479
...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |