Check writer [C++]-Help please!

Hello I am having trouble having my program print out from integers to string in order to display a written form of the number. Here is what my files look like.

This is my class tester .cpp file (NO changes needed)

#include <iostream>  
#include <iomanip>
#include <string>
#include <string.h>
#include <sstream>
#include "TextVersionOfNumber.h"
using namespace std;
// Assume a maximum amount of $10,000

int main()
{
	string date = "03/07/2013", payee = "Greg Dunkin";
	TextVersionOfNumber checkAmount;
	double testAmounts[] = { 0, .01, .25, 12.12, 12.45, 19, 19.02,
		19.45, 20, 20.65,
		34, 56.78, 100.21, 109.05, 119.78,
		450, 678.90, 1000, 1009.45, 1056,
		1234.15, 1567.98,9999, 9999.99 };
	cout << setprecision(2) << fixed;

	for (int i = 0; i < sizeof(testAmounts) / sizeof(double); i++)
	{
		double an_amount = testAmounts[i];
		checkAmount.setAmount(an_amount);

		cout << setprecision(2) << fixed;
		cout << setw(60) << right;
		cout << "Date: " << date << endl;
		cout << "Pay to the order of:  " << payee << "\t\t\t";
		cout << "$" << an_amount << endl;
		cout << checkAmount.getTextVersionOfNumber() << endl;
		cout << "--------------------------------------------\n";
	}
	return 0;
}

This is my class header file (.h)

#pragma once
#include <iostream>  //std::cout
#include <iomanip>
#include <string>  //std::string
#include <sstream>  //std:;stringstream
#include <string.h>
using namespace std;
class TextVersionOfNumber
{
private:
	double amount;
public:
	string getTextVersionOfNumber();
	void setAmount(double);
};

And this is my class .cpp file

#include <iostream>
#include <string>
#include <iomanip>
#include <string.h>
#include <sstream>
#include "TextVersionOfNumber.h"
using namespace std;

string TextVersionOfNumber::getTextVersionOfNumber()
{
	string one_19[] = { "zero", "one", "two", "three", "four",
		"five", "six", "seven", "eight", "nine", "ten",
		"eleven", "twelve",
		"thirteen", "fourteen", "fifteen", "sixteen", "seventeen",
		"eighteen", "nineteen" };

	string twenty_90[] = { "","","twenty","thirty","forty",
		"fifty", "sixty", "seventy", "eighty", "ninety" };

	int thousand = amount / 1000;
	int hundred = (amount - thousand * 1000) / 100;
	int tens = ((amount - (thousand * 1000 + hundred * 100)) / 10);
	int ones = (amount - (thousand * 1000 + hundred * 100)) - tens * 10;
	int cents_tens = (amount - (thousand * 1000 + hundred * 100) - tens * 10 - ones) * 10;
	int cents_ones = (amount - (thousand * 1000 + hundred * 100) - tens * 10 - ones) * 100 - cents_tens * 10;


	if (amount < 1.0)
		cout << "zero dollars and " << twenty_90[cents_tens] << one_19[cents_ones] << " cents.\n";
	else if (amount < 20)
		cout << one_19[ones] << "dollar and " << twenty_90[cents_tens] << "-" << one_19[cents_ones];
	else if (amount <100)
	{
		cout << twenty_90[tens] << "-" << one_19[ones] << "dollars and " << twenty_90[cents_tens] << "-" << one_19[cents_ones] << " cents.";
	}
	else if (amount < 1000)
	{
		cout << one_19[hundred] << "hundred and" << twenty_90[tens] << "-" << one_19[ones] << " dollars and " << twenty_90[cents_tens] << "-" << one_19[cents_ones] << " cents. ";

	}
	else if (amount < 10000)
	{
		cout << one_19[thousand] << "thousand " << one_19[hundred] << "hundred and" << twenty_90[tens] << "-" << one_19[ones] << " dollars and " << twenty_90[cents_tens] << "-" << one_19[cents_ones] << " cents. ";
	}
	else;
	return 0;
}
void TextVersionOfNumber::setAmount(double _set_amount)
{
	amount = _set_amount;
}

I keep recieving an error message but not sure what is wrong.

Your declared your method string getTextVersionOfNumber(); to return a string.
At the end of it you return 0 and it tries to construct a string from the number 0.

Which the first link when searching for your error message hints at:

http://stackoverflow.com/questions/11705886/how-to-avoid-the-error-terminate-called-after-throwing-an-instance-of-stdlog

Some generic hints for your journey

  • Learn to use breakpoints and the debugger early on. It helps immensly when looking for bugs you don’t immediately see.
  • Always post your error message when asking for help