473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C2264 Error in C++, totally lost

1 New Member
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\d esktop\project1 \project1\invme nu.cpp(75) : error C2664: 'BookData::SetI SBN' : 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(BookDat a books[]);

#endif

------------------------------------

INVMENU.CPP

#include "BookData.h "
#include "invmenu.h"

void lookup();
void addbook();

void lookup()
{
system("cls");
string ISBN;
BookData isbn;

cout << "Serendipit y Booksellers\n";
cout << "Book information";

cout << "Please enter ISBN: ";
cin.ignore();
getline(cin, ISBN);
isbn.SetISBN(is bn);
cout << &BookData::GetI SBN;

// BookData::SetTi tle();
// BookData::SetAu thor();
// BookData::GetPu blisher();
// BookData::GetDa teadd();
// BookData::GetOn hand();
// BookData::GetWh olepri();
// BookData::GetRe tPri();
}

---------------------------------------

#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(strin g& a);

string GetPublisher();
void SetPublisher(st ring& p);

string GetDateadd();
void SetDateadd(stri ng& d);

double GetOnhand();
void SetOnhand(doubl e& o);

double GetWholepri();
void SetWholepri(dou ble& w);

double GetRetpri();
void SetRetpri(doubl e r);
};

#endif

---------------------------------------------------------

//Inventory menu

#include "BookData.h "

void bookmenu()
{
cout << "Serendipit y Booksellers\n";
cout << "Book Information\n";
}
//Book's Title
string BookData::GetTi tle()
{
return title;
}
void BookData::SetTi tle(string& s)
{
cin.ignore();
cout << "\nBook's Title: ";
getline(cin, s);
}
//Book's ISBN
string BookData::GetIS BN()
{
return isbn;
}
void BookData::SetIS BN(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.
Apr 9 '07 #1
3 3772
imcram
15 New Member
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\d esktop\project1 \project1\invme nu.cpp(75) : error C2664: 'BookData::SetI SBN' : 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(BookDat a books[]);

#endif

------------------------------------

INVMENU.CPP

#include "BookData.h "
#include "invmenu.h"

void lookup();
void addbook();

void lookup()
{
system("cls");
string ISBN;
BookData isbn;

cout << "Serendipit y Booksellers\n";
cout << "Book information";

cout << "Please enter ISBN: ";
cin.ignore();
getline(cin, ISBN);
isbn.SetISBN(is bn);
cout << &BookData::GetI SBN;

// BookData::SetTi tle();
// BookData::SetAu thor();
// BookData::GetPu blisher();
// BookData::GetDa teadd();
// BookData::GetOn hand();
// BookData::GetWh olepri();
// BookData::GetRe tPri();
}

---------------------------------------

#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(strin g& a);

string GetPublisher();
void SetPublisher(st ring& p);

string GetDateadd();
void SetDateadd(stri ng& d);

double GetOnhand();
void SetOnhand(doubl e& o);

double GetWholepri();
void SetWholepri(dou ble& w);

double GetRetpri();
void SetRetpri(doubl e r);
};

#endif

---------------------------------------------------------

//Inventory menu

#include "BookData.h "

void bookmenu()
{
cout << "Serendipit y Booksellers\n";
cout << "Book Information\n";
}
//Book's Title
string BookData::GetTi tle()
{
return title;
}
void BookData::SetTi tle(string& s)
{
cin.ignore();
cout << "\nBook's Title: ";
getline(cin, s);
}
//Book's ISBN
string BookData::GetIS BN()
{
return isbn;
}
void BookData::SetIS BN(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

Expand|Select|Wrap|Line Numbers
  1. BookData isbn;
  2.  
somewhere, and there is a private member isbn in ur BookData class as well. U better check it.
Apr 9 '07 #2
Ganon11
3,652 Recognized Expert Specialist
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.
Apr 9 '07 #3
Coldfire
289 Contributor
string ISBN;
BookData isbn;

note that variables are not case-sensitive. You better change the vairable names
like
string sISBN;
BookData objISBN;
Apr 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
1678
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 ((Year(event_date) = #2004# and event_is_reserved = '0') or event_is_reserved = '1' ) produces this error: Microsoft JET Database Engine error '80040e07'
1
6104
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 restart my database. It froze mid shutdown, and I was unable to re-connect. After trying everything I could think of to restart it, I finally tried...
8
1575
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 start? That's my output: d:\Programme\Microsoft Visual Studio .NET 2003\Vc7\include\functional(139) : error C2784: 'bool std::operator
3
1740
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 different sized tables, in datasheet view, I've gotten this message -
1
1363
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 complete - there's a little progress bar in the lower left area of the status bar that gets about halfway done, and then stalls. It doesn't keep me...
1
10496
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 8007002. I don't know how to fix it so far. The sample is...
1
1498
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 tell me if its possible to auto create a 4 digit randomly code 1st digit alpha 2nd -4th numeric that gets looked up in the db if its there new code is...
13
1892
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 field? Many thanks as I'm totally lost on this.
2
1105
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 Code:
0
7698
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.