Problem: Write a class that defines a car. The car class stores the following data about a car:
Member Name Data Type
make string
model string
vin string
owner string
doors int
mileage float
gas tank float
trip float
gas remaining float

Create methods to set data into the data members and to read the data from the data members. Write a method to determine the gas mileage.

What I got so far is:

#include <iostream>
#include <string>
using namespace std;

class car
{
private:
	string make,
		   model,
		   vin,
		   owner;
	int doors;
	float mileage,
		  gasTank,
		  trip,
		  gasRemaining;
public:
	string getMake();
	string getModel();
	string getOwner();
	int getDoors();
	float getMileage();
	float getGasTank();
	float getTrip();
	float getGasRemaining();
	double getGasMilease();
};

int main()
{
	car cars;

	cout << " Please enter Make of car: ";
	cin >> cars.make;

	return 0;
}

string car::getMake()
{
	return make;
}

I am getting the following errors:
1>.\CH 7 Addendum 2 Car Class.cpp(41) : error C2248: 'car::make' : cannot access private member declared in class 'car'
1> .\CH 7 Addendum 2 Car Class.cpp(15) : see declaration of 'car::make'
1> .\CH 7 Addendum 2 Car Class.cpp(13) : see declaration of 'car'

This week we just started to learn about classes so I am totally lost even after reading the textbook several times and looking over their examples. Can anyone help me understand what I am doing wrong with the class?

I get error cars::make cannot access... which is slightly, and subtly, different than what you report.

It comes from this line:

cin >> cars.make;

You've only done half the assignment - you've declared the get.... methods, also known as accessors. You need to create the set... methods (mutators) as well. To do what you've tried to do above would involve the setMake( ) method, to follow your pattern. Usually one reads into a temp variable of the appropriate type, then passes that as an argument to the set.... method.

The actual error is in main() in line 34. You have make declared as private in your class so you cannot access it with the dot operator. In the same way as you have a getMake() method, you need a setMake() method to change the private value and act as an "interface" (that word can have other meanings in other situations but I mean it generically) between the outside and your class.

So have a public method void setMake(string inmake) {make = inmake;} EDIT: nice vmanes :)

OK I am half way lost. I understand what you 2 are saying but how do I do it. I made the following changes but still nothing.

#include <iostream>
#include <string>
using namespace std;

class car
{
private:
	string make,
		   model,
		   vin,
		   owner;
	int doors;
	float mileage,
		  gasTank,
		  trip,
		  gasRemaining;
public:
	void setMake(string m);
	string getMake();
	string getModel();
	string getOwner();
	int getDoors();
	float getMileage();
	float getGasTank();
	float getTrip();
	float getGasRemaining();
	double getGasMilease();
};

int main()
{
	car cars;
	string carsmake;

	cout << " Please enter Make of car: ";
	cin >> cars.make;

	cars.setMake(cars.make);

	return 0;
}
void car::setMake(string m)
{
	make = m;
}

string car::getMake()
{
	return make;
}

Anything that's private, forget about using the dot operator with it at all. You're closer:

string carsmake;

	cout << " Please enter Make of car: ";
	cin >> carsmake;  //taking into your temporary
                              // (this presumes a one word car make btw)
	cars.setMake(carsmake); //passes in through your method,
                                 //compiler is happy

Thanks! I will do the rest like that and see what happens!

Ok I must be very ignorant here because I filled in the rest of the code and I JACKED IT UP. I am not getting over 70 errors....Bash my head in here.

#include <iostream>
#include <string>
using namespace std;

class car
{
private:
	string make,
		   model,
		   vin,
		   owner;
	int doors;
	float mileage,
		  gasTank,
		  trip,
		  gasRemaining;
public:
	void setMake(string m);
	void setModel(string mod);
	void setOwner(string own);
	void setDoors(int d);
	void setMileage(float mile);
	void setGasTank(float gasT);
	void setTrip(float t);
	void setGasRemaining(float gasR);
	string getMake();
	string getModel();
	string getOwner();
	int getDoors();
	float getMileage();
	float getGasTank();
	float getTrip();
	float getGasRemaining();
	double getGasMileage();
};

int main()
{
	car cars;
	string carsMake, 
		   carsModel,
		   carsOwner; 
	int carsDoors;
	float carsMileage,
		  carsGasTank,
		  carsTrip, 
		  carsGasRemaining;

	cout << "Please enter Make of car: ";
	cin >> carsMake;
	cout << "Please enter Model of car: ";
	cin >> carsModel;
	cout << "Enter owner of car: ";
	cin >> carsOwner;
	cout << "Enter number of doors on car: ";
	cin << carsDoors;
	cout << "Enter Mileage: ";
	cin >> carsMileage;
	cout << "Enter amount of gallons the gas tank holds: ";
	cin >> carsGasTank;
	cout << "Enter miles on odometer: ";
	cin >> carsTrip;
	cout << "Enter amount of gallons in gas tank: ";
	cin >> carsGasRemaining;

	cars.setMake(carsMake);
	cars.setModel(carsModel);
	cars.setOwner(carsOwner);
	cars.setDoors(carsDoors);
	cars.setMileage(carsMileage);
	cars.setGasTank(carsGasTank);
	cars.setTrip(carsTrip);
	cars.setGasRemaining(carsGasRemaining)

	return 0;
}
void car::setMake(string m)
{
	Make = m;
}
void car::setModel(string mod);
{
	Model = mod;
}
void car::setOwner(string own);
{
	Owner = own;
}
void car::setDoors(int d);
{
	Doors = d;
}
void car::setMileage(float mile);
{
	mMileage = mile;
}
void car::setGasTank(float gasT);
{
	GasTank = gasT;
}
void car::setTrip(float t);
{
	Trip = t;
}
void car::setGasRemaining(float gasR);
{
	GasRemaining = gasR;
}
string car::getMake()
{
	return Make;
}
string car::getModel()
{
	return Model;
}
string car::getOwner()
{
	return Owner;
}
int car::getDoors()
{
	return Doors;
}
float car::getGasMileage()
{
	return GasMileage;
}
float getGasTank();
{
	return GasTank;
}
float getTrip();
{
	return Trip;
}
float getGasRemaining();
{
	return GasRemaining;
}

I followed exactly like carsmake....

All right, breathe now breathe. All small things:

void car::setMileage(float mile) 
{       //no semicolon after the method definition
     mMileage = mile;
     //mMileage must be a private variable, yours is called something else
}

And for the others, variables are case sensitive.

ok i got rid of all the ; after the void calls, dropped to 64 errors, got rid of the mMileage to Mileage...maybe its getting late for me it is 3am here, ill take a crack tomorrow.l.......aggravating stuff, dont know how you guys learned this and actually understand it.

It's gotta be mileage with a lowercase m. Make sure the variables in the set statements match the case of those in the private: section.

You'll see that once you knock a couple of these errors off the rest may be residual.

Some of us are still learning. It doesn't end. Not a bad thing.

very small errors indeed just a word of advice...use ( this -> ) in ur set functions. it will help in big projects. what it does is if ur use 2 variabli in ur class with same name it is able to differentiate for eg

void car::setMake(string Make)
       

      {
   
       
   
      Make = this -> Make;

       
  
      }

OK I got most of it fixed so far but now I get 3 errors in the program.
I commented the doors information in the program because I get most of my errors from that so I will look into it further after I get my current errors resolved. Here is my code.

#include <iostream>
#include <string>
using namespace std;

class car
{
private:
	string make,
		   model,
		   vin,
		   owner;
	int doors;
	float mileage,
		  gasTank,
		  trip,
		  gasRemaining;
public:
	void setMake(string m);
	void setModel(string mod);
	void setOwner(string own);
	void setDoors(int d);
	void setMileage(float mile);
	void setGasTank(float gasT);
	void setTrip(float t);
	void setGasRemaining(float gasR);
	string getMake();
	string getModel();
	string getOwner();
	int getDoors();
	float getMileage();
	float getGasTank();
	float getTrip();
	float getGasRemaining();
	double getGasMileage();
};

int main()
{
	car cars;
	string carsMake,
		   carsModel,
		   carsOwner; 
	//int carsDoors;
	float carsMileage,
		  carsGasTank,
		  carsTrip,
		  carsGasRemaining;

	cout << "Please enter Make of car: ";
	cin >> carsMake;
	cout << "Please enter Model of car: ";
	cin >> carsModel;
	cout << "Enter owner of car: ";
	cin >> carsOwner;
	//cout << "Enter number of doors on car: ";
	//cin << carsDoors;
	cout << "Enter Mileage: ";
	cin >> carsMileage;
	cout << "Enter amount of gallons the gas tank holds: ";
	cin >> carsGasTank;
	cout << "Enter miles on odometer: ";
	cin >> carsTrip;
	cout << "Enter amount of gallons in gas tank: ";
	cin >> carsGasRemaining;

	cars.setMake(carsMake);
	cars.setModel(carsModel);
	cars.setOwner(carsOwner);
	//cars.setDoors(carsDoors);
	cars.setMileage(carsMileage);
	cars.setGasTank(carsGasTank);
	cars.setTrip(carsTrip);
	cars.setGasRemaining(carsGasRemaining);

	return 0;
}
void car::setMake(string m)
{
	make = m;
}
void car::setModel(string mod)
{
	model = mod;
}
void car::setOwner(string own)
{
	owner = own;
}
//void car::setDoors(int d)
//{
//	doors = d;
//}
void car::setMileage(float mile)
{
	mileage = mile;
}
void car::setGasTank(float gasT)
{
	gasTank = gasT;
}
void car::setTrip(float t)
{
	trip = t;
}
void car::setGasRemaining(float gasR)
{
	gasRemaining = gasR;
}
string car::getMake()
{
	return make;
}
string car::getModel()
{
	return model;
}
string car::getOwner()
{
	return owner;
}
//int car::getDoors()
//{
//	return doors;
//}
float car::getMileage()
{
	return mileage;
}
float getGasTank()
{
	return gasTank;
}
float getTrip()
{
	return trip;
}
float getGasRemaining()
{
	return gasRemaining;
}

Errors:
1>.\CH 7 Addendum 2 Car Class.cpp(138) : error C2065: 'gasTank' : undeclared identifier
1>.\CH 7 Addendum 2 Car Class.cpp(142) : error C2065: 'trip' : undeclared identifier
1>.\CH 7 Addendum 2 Car Class.cpp(146) : error C2065: 'gasRemaining' : undeclared identifier

I dont know why they are coming up as "undeclared identifier". I declared them in my statements. Can anyone see why I get these errors?

You forgot the car:: on the last three methods.

What you want to be returning with the getDoors() is carsDoors. The names of the private variables must match up exactly. The reason you have some leeway with the method parameters is that the names are essentially local to that method. Think of your methods as being a go between for the private members and the outside world.

just that u have missed the function class in your get functions. note when u have used functions inside a class.you must specify the function class when defining it else its treated as a completely different and singular function on its own

thanks everyone, now I just got to get the Doors variable to work.

You can post back what you have but I think you're probably so close to it that you'll find it without a problem.

The program works as long as you comment out the code that pertains to doors. It gives 40+ errors and I cannot figure it out. I read over the book again, looked at the examples, looked at my code. I posted the errors as well hoping they will jump out at me or something.

#include <iostream>
#include <string>
using namespace std;
class car
{
	private:
		string make,
		model,
		vin,	
		owner;
		int doors;
		float mileage,
		gasTank,
		trip,
		gasRemaining;
	public:	
		void setMake(string m);	
		void setModel(string mod);	
		void setOwner(string own);	
		void setDoors(int d);	
		void setMileage(float mile);	
		void setGasTank(float gasT);	
		void setTrip(float t);	
		void setGasRemaining(float gasR);	
		string getMake();	
		string getModel();	
		string getOwner();	
		int getDoors();	
		float getMileage();	
		float getGasTank();	
		float getTrip();	
		float getGasRemaining();	
		double getGasMileage();
}; 
int main()
{	
	car cars;	
	string carsMake,		   
		carsModel,		   
		carsOwner; 	
	int carsDoors;	
	float carsMileage,		 
		carsGasTank,		  
		carsTrip,		  
		carsGasRemaining; 	
	
	cout << "Please enter Make of car: ";	
	cin >> carsMake;	
	cout << "Please enter Model of car: ";	
	cin >> carsModel;	
	cout << "Enter owner of car: ";	
	cin >> carsOwner;	
	cout << "Enter number of doors on car: ";	
	cin << carsDoors;	
	cout << "Enter Mileage: ";	
	cin >> carsMileage;	
	cout << "Enter amount of gallons the gas tank holds: ";	
	cin >> carsGasTank;	cout << "Enter miles on odometer: ";	
	cin >> carsTrip;	
	cout << "Enter amount of gallons in gas tank: ";	
	cin >> carsGasRemaining; 	
	
	cars.setMake(carsMake);	
	cars.setModel(carsModel);	
	cars.setOwner(carsOwner);	
	cars.setDoors(carsDoors);	
	cars.setMileage(carsMileage);	
	cars.setGasTank(carsGasTank);	
	cars.setTrip(carsTrip);	
	cars.setGasRemaining(carsGasRemaining); 	
	return 0;
}
void car::setMake(string m)
{	
	make = m;
}
void car::setModel(string mod)
{	
	model = mod;
}
void car::setOwner(string own)
{	
	owner = own;
}
void car::setDoors(int d)
{
	doors = d;
}
void car::setMileage(float mile)
{	
	mileage = mile;
}
void car::setGasTank(float gasT)
{
	gasTank = gasT;
}
void car::setTrip(float t)
{
	trip = t;
}
void car::setGasRemaining(float gasR)
{
	gasRemaining = gasR;
}
string car::getMake()
{	
	return make;
}string car::getModel()
{	
	return model;
}
string car::getOwner()
{	
	return owner;
}
int car::getDoors()
{
	return doors;
}
float car::getMileage()
{	
	return mileage;
}
float car::getGasTank()
{
	return gasTank;
}
float car::getTrip()
{	
	return trip;
}
float car::getGasRemaining()
{	
	return gasRemaining;
}

Errors:

1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(930) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(923) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(916) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(909) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(871) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(825) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(785) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(738) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(700) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1> c:\program files\microsoft visual studio 9.0\vc\include\ostream(653) : see declaration of 'std::operator <<'
1>r:\my documents\visual studio 2008\projects\anthony berger\anthony berger\baer.cpp(54) : error C2676: binary '<<' : 'std::istream' does not define this operator or a conversion to a type acceptable to the predefined operator

Oh my....I am going to slap myself silly.....I figured it out after posting the latest update....I was using << for cin instead of >>....snapfu.

Yes, you'll see later that if you want to use your object with cout you have to "overload" the << operator. If you don't have that in place and try to output an object (which is effectively what you did) the compiler panics. I'm still not sure why it does it 80 times but I'm sure there's a reason.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.