HI

I'm getting the runtime error as above when running very simple C++ progs.

I have a very simple test program as follows. It gives me the error. Note there are three pairs of calls to the functions 'm_setvalues' and 'm_gettitle'. If I delete a pair of these the program runs OK.

I can get similar behaviour playing with vectors.

Any ideas welcome.

#include <conio.h>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <vector>
#include <list>
#include <map>
#include <string>

using namespace std;

// A vector based class to contain our items

class c_books {
public:

string m_title;
string m_author;
int m_price;
string m_isbn;
string m_gettitle();
void m_setvalues(string title, string author, int price, string isbn);
};

string c_books::m_gettitle()
{
cout << "Title = " << m_title << "\n";
cout << "Author = " << m_author << "\n";
cout << "Price = " << m_price << "\n";
cout << "ISBN = " << m_isbn << "\n";
};

void c_books::m_setvalues(string title, string author, int price, string isbn)
{
m_title = title;
m_author = author;
m_price = price;
m_isbn = isbn;
};

int main(){
// Create multimap
multimap <string, c_books> mapbooks;

// Create class
c_books ci_books;

// Populate class instance ci_books
ci_books.m_setvalues("blue Peter Annual 2001", "Val Singleton", 15, "2001ISBN");
// Out put title
ci_books.m_gettitle();

// Populate class instance ci_books
ci_books.m_setvalues("blue Peter Annual 2002", "Val Singleton", 15, "2002ISBN");
// Out put title
ci_books.m_gettitle();

// Populate class instance ci_books
ci_books.m_setvalues("blue Peter Annual 2003", "Val Singleton", 15, "2002ISBN");
// Out put title
ci_books.m_gettitle();

// Load object into multimap
mapbooks.insert (make_pair (ci_books.m_isbn, ci_books));

// Output map size
cout << "No of elements = " << mapbooks.size() << "\n";

getch();
}