M
MeganTSU
Hey yall! I am trying to get this program finished for class.... It
says that you are suppposed to write a program that will display a
check formatted out put (the output looks like a check). I got
everything to work and it will compile and run......
BUT.... I dont know how to turn the 'Amount' into a charater string
that puts the number into words.... It is supposed to show the name,
then the amount, and then on the next line write out the amount, just
like you would on a real check....
I have attached a copy of the program that I have so far.... PLEASE
help if you can.... this has got me stuck.....
note: the amount of the check can be up to $10,000.00
Thanks for your time!
Here is my code:
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
string name;
string lname;
string date;
float amount;
cout << "Please enter the date of the paycheck. (mm/dd/yy)" <<
endl;
cin >> date;
cout << "Please enter the first name of the Payee." << endl;
cin >> name;
cout << "Please enter the last name of the Payee." << endl;
cin >> lname;
cout << "Please enter the amount of the paycheck." << endl;
cin >> amount;
if (amount > 10000)
{ cout << " Amount cannot be over $10,000.00. Please
reenter the amount." << endl;
cin >> amount;
}
cout << "Here is your check printed out: " << endl;
cout << setw(55)<< date << endl;
cout << endl;
cout << left << name << " " << lname << setw(15);
cout << setw(35) << right << "$ " << showpoint << amount << endl;
// need to figure out how to change the float 'amount' into charaters.
return 0;
}
says that you are suppposed to write a program that will display a
check formatted out put (the output looks like a check). I got
everything to work and it will compile and run......
BUT.... I dont know how to turn the 'Amount' into a charater string
that puts the number into words.... It is supposed to show the name,
then the amount, and then on the next line write out the amount, just
like you would on a real check....
I have attached a copy of the program that I have so far.... PLEASE
help if you can.... this has got me stuck.....
note: the amount of the check can be up to $10,000.00
Thanks for your time!
Here is my code:
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
string name;
string lname;
string date;
float amount;
cout << "Please enter the date of the paycheck. (mm/dd/yy)" <<
endl;
cin >> date;
cout << "Please enter the first name of the Payee." << endl;
cin >> name;
cout << "Please enter the last name of the Payee." << endl;
cin >> lname;
cout << "Please enter the amount of the paycheck." << endl;
cin >> amount;
if (amount > 10000)
{ cout << " Amount cannot be over $10,000.00. Please
reenter the amount." << endl;
cin >> amount;
}
cout << "Here is your check printed out: " << endl;
cout << setw(55)<< date << endl;
cout << endl;
cout << left << name << " " << lname << setw(15);
cout << setw(35) << right << "$ " << showpoint << amount << endl;
// need to figure out how to change the float 'amount' into charaters.
return 0;
}