Question: It should be perfectly run for xcode and please must add int main() in this assignment Currency. input Wibe a Ct+ progam that will ahow
Currency. input Wibe a Ct+ progam that will ahow the user to enter a currency anount and valdate that it is in a contect format. For purposes of this program, the corroct format of curoncy the following: \$1234 The $ aigh folowed by an intoger number $12345 the $ sign followed by a real number. If a decimal point is inchuded in the number, there must be exactly 2 digits fo the fight of the decimal point 51,234.56 There can be commis 6 the now of the decima point but they must awins be in the correct place (hint - here must be 3 integar values in the right of the comme. No commas aller the decimal point) $1,23456 There can be a negative sign betore the dolar sign 12e A one or two digit integer followed by a cent sign. Create a function that will do the validation and if valid, will convert the number to a "double" and return it to the calling function. Your main function sbould do the following 1. Prompt the use to end a currency amount 2. Read the inpet into a C-Style string 3. Cill the function you created above to conven the amount. If the amount is valid, then display the amount in the form of a real (double) amount 4. Prompt the use if thcy wish to enter a new value (yea/ no)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
