Hello, I am working on a program that is using the type DATE to develop a class Event to model events scheduled for dates. This might be a familiar question to some, but, I have run into an error during the compile and I need help in debugging it. Below should be the components of the program:

//EventSchedule.ccp  Use the type Date to develop a class Event.

#include <iostream>
#include <vector>
#include <algorithm>
#include "DateClass.h"
#include "EventsClass.h"

using namespace std;

int main()
{
	char quit;
	vector < pair <Date, Event> > eventDate;
	vector < pair <Date, Event> >::iterator iter;

	cout << "Enter the date of an event (format: mm/dd/yyyy) and the event name" << endl;
	do{
		Date dateIn;
		Event eventIn;
		cin >> dateIn >> eventIn;
		eventDate.push_back(make_pair(dateIn, eventIn));

		cout << "Do you have more entries? Enter 'y' or 'n'" << endl;
		cin >> quit;
	}while (quit != 'n');

	sort(eventDate.begin(), eventDate.end());

	while (iter != eventDate.end())
		cout << *iter++;

	system("PAUSE");
}

I am getting an error in the EventsClass.cpp at line(13) and (20):

error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

and a similar error in the DateClass.cpp at lines (126) and the main at line (44).

I assume that fixing one of them might fix them all. But, I am at a lost as to which one to track down first.

Any help would be appreciated...and thanks in advance.

>>error C2679: binary '>>' : no operator found which takes a right-hand operand of type
>>'std::string' (or there is no acceptable conversion)

you forgot to include <string>

line 30 of the code you posted: the iterator iter has never been set to anything, so that loop won't work right.

//--------Event input----------
void Event::read(istream& in)
{
	string eventIn;
	in >> eventIn;
	setEvent(eventIn);
}

Above at the in >> eventIn; is where the error starts. As I understand it, whatever is in the istream is being inserted into the variable "eventIn". I have declared this varaible as a string data type which confuses me as to getting an error at this location.

Is the error being caused by the declaration of the vector array (vector < pair <Date, Event> > eventDate;)?

You're correct about not setting the variable "iter", I forgot to include that line of code.

Thanks for the hit in the head...that loud popping sound you heard was my head coming out of my @#$. I included the <string> header and do you know what....the error magically disappeared. I also added the missing declaration line for the "iter". Fixing these seemed to open up a Pandora's box and I got 12 new errors to solve. At first glance, it looks like the compiler doesn't like the way I declared the vector array. Time to go back to the drawing board.....

This question has already been answered. Start a new discussion instead.