Jul 17, 2015 at 4:07am UTC
I am having trouble converting the numbers into its English version for example $723.63 to Seven hundred and twenty three dollars and sixty three cents.
Also my cin getline seem to be messed up when before they worked perfectly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
#include <cstdlib>
#include <iostream>
#include <cstring>
using namespace std;
string hundreds(int );
string first(int );
string second(int );
string cents(int ,int );
string getWholeNum(int );
int main(int argc, char ** argv) {
//Declare variables
string Name;
string Date;
float n;
string holder;
cout<<"Input the date: " <<endl;
cin>>Date;
cout<<"Input the name: " ;
cin>>Name;
cin.ignore();
getline(cin,Name);
cout<<"Input the amount in usd $" ;
cin>>n;
cout<<"Input the name of the holder: " ;
cin>>holder;
getline(cin,holder);
//123.55
int d=n;//123
int c=(n-d)*100;//.55
return 0;
}
string getWholeNum(int n){
int f=(n%10);
string whole;
}
string hundreds(int a){
if (a==100){return "One Hundred and" ;}
if (a==200){return "Two Hundred and" ;}
if (a==300){return "Three Hundred and" ;}
if (a==400){return "Four Hundred and" ;}
if (a==500){return "Five Hundred and" ;}
if (a==600){return "Six Hundred and" ;}
if (a==700){return "Seven Hundred and" ;}
if (a==800){return "Eight Hundred and" ;}
if (a==900){return "Nine Hundred and" ;}
}
string first(int a){
if (a==0){return "" ;}
if (a==1){return "ten" ;}
if (a==2){return "twenty" ;}
if (a==3){return "thirty" ;}
if (a==4){return "forty" ;}
if (a==5){return "fifty" ;}
if (a==6){return "sixty" ;}
if (a==7){return "seventy" ;}
if (a==8){return "eighty" ;}
if (a==9){return "ninety" ;}
}
string second(int a){
if (a==0){return "" ;}
if (a==1){return "one" ;}
if (a==2){return "two" ;}
if (a==3){return "three" ;}
if (a==4){return "four" ;}
if (a==5){return "five" ;}
if (a==6){return "six" ;}
if (a==7){return "seven" ;}
if (a==8){return "eight" ;}
if (a==9){return "nine" ;}
}
string cents(int &n,int ){
int d=n;
cout<<" cents" ;
}
Last edited on Jul 17, 2015 at 6:30am UTC
Jul 17, 2015 at 5:44am UTC
Last edited on Jul 17, 2015 at 5:45am UTC
Jul 17, 2015 at 5:47am UTC
Thank you for showing me i have been wanting to learn that. Now any help would be appreciated.
Jul 17, 2015 at 6:33am UTC
I typed 500 and it outputted -
500
500
0
0
5
0
I am unsure why, shouldn't it output the wording and those numbers
Last edited on Jul 17, 2015 at 6:34am UTC
Jul 17, 2015 at 4:54pm UTC
I'm not writing it for you just showing you how to get the individual numbers.
The last number 0 after the 5 is because there is no thousands in 500, so you might want to include if statements
Last edited on Jul 17, 2015 at 4:55pm UTC
Jul 17, 2015 at 5:51pm UTC
I know just thats my problem i dont know how to input it into the functions and retrieve it.