lclarius
asked on
US dollar inputs are from .01 to 1000.00. Have the program repeat after it displays the results. Have the program use the value of 0 to end. All other input values are rejected with an error message a
US dollar inputs are from .01 to 1000.00. Have the program repeat after it displays the results. Have the program use the value of 0 to end. All other input values are rejected with an error message and warning.
Use a function for the input question and a function for the currency conversion display parts of the program.
I'M ERRORING OUT ON THE REPEAT - PLEASE HELP ME
/*------------------------
Purpose: US Dollar Currency Conversion
Version History: // PRO375, UOP //
Name: CurrencyConversionLisaClar
Number: 3 // Week Three //
Date:09/27/04
Student Programmer: Lisa Clarius
Verison: IA Wk 2 // revised for Wk 4//
Purpose: Week Four IA coding
Date Revised: 10/06/04
Revised by: LDC
Instructor: Lon Hosford
--------------------------
#include <stdio.h>
int main ()
{
/*Variables for the various exchange rates */
/* The variables names represent the foreign nations. Exchange reates were obtain */
/* from The Federal Reserve Bank of New York, representing the time 12:00 noon */
/* buying rates and the International Monetary Fund according to thier availability */
// --------------------------
float British = 0.557227;
float Canadian = 1.2886;
float European = 0.815395;
float Australian= 1.42633;
float Mexican = 11.4275;
//------------------------
/* Variables for the demominations rate of the foreign currencies */
/* The variable names are representatives of foreign nations*/
char British_unit[]="pounds";
char Canadian_unit[]= "dollars";
char European_unit[]= "euros";
char Australian_unit[]="dollars
char Mexican_unit[]="pesos";
//------------------------
/*Display the the value of the foreign exchange currency to one USdollar*/
/*------------------------
scanf("%f,&value"); /* for one USdollar */
/*Display report title and date of conversion */
printf("******************
printf(" POS370 Currency Conversion Rates\n");
printf(" 06 October 2004 /n ");
printf("******************
/* Display the exchange rates and verify USdollar inputs for British, Candian, European, Augralian and Mexican */
printf ("Exchange Rates For US $1.00\n\n");
printf (" Country Rate\n");
printf ("------------------------
printf ("Great Britian: %f%s\n",British, British_unit);
printf (" Canada: %f%s\n",Canadian,Canadian_
printf (" Europe: %f%s\n",European, European_unit);
printf (" Australia: %f%s\n", Australian, Australian_unit);
printf (" Mexico: %f%s\n", Mexican, Mexican_unit);
/*------------------------
/*Display USdollar amount and verify all foreign currency */
printf("Enter a dollar amount .01 to 1000.00 for all listed currencies to one USdollar");
/*Display variable repeat and the value for USdollar */
repeat=='y'|| repeat =='y';
Usdollars<=.01 && USdollars>=1000.0;
endOFFile== EOF
printf(" Foreign currencies verfiy to one USdollar").
printf ("The End")
printf("Press Enter to end Program\n");
getchar();
return 0;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm sorry if i made some mistake. I gived up C, so i do this only from a memory. Don't evan have a compiler to test this. :)
do this:
float value,brcur,cancur,eurcur, auscur,mex cur; //declaration part, should be above
scanf("%f",value); /* for one USdollar */
while (value!=0) do
{
if (value<.01 && value>1000.0)
{
//input is wrong
printf("Error:Wrong input. Range should be between 0.01 and 1000.00");
}else
{
//input is right
brcur=British*value; cancur=Canadian*value; eurcur=European*value; auscur=Australian*value; mexcur=Mexican*value;
printf ("Exchange Rates For US %f\n\n",value);
printf (" Country Rate\n");
printf ("------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------\ n\n");
printf ("Great Britian: %f%s\n",brcur, British_unit);
printf (" Canada: %f%s\n",cancur,Canadian_un it);
printf (" Europe: %f%s\n",eurcur, European_unit);
printf (" Australia: %f%s\n", auscur, Australian_unit);
printf (" Mexico: %f%s\n", maxcur, Mexican_unit);
}
scanf("%f",value);
}
do this:
float value,brcur,cancur,eurcur,
scanf("%f",value); /* for one USdollar */
while (value!=0) do
{
if (value<.01 && value>1000.0)
{
//input is wrong
printf("Error:Wrong input. Range should be between 0.01 and 1000.00");
}else
{
//input is right
brcur=British*value; cancur=Canadian*value; eurcur=European*value; auscur=Australian*value; mexcur=Mexican*value;
printf ("Exchange Rates For US %f\n\n",value);
printf (" Country Rate\n");
printf ("------------------------
printf ("Great Britian: %f%s\n",brcur, British_unit);
printf (" Canada: %f%s\n",cancur,Canadian_un
printf (" Europe: %f%s\n",eurcur, European_unit);
printf (" Australia: %f%s\n", auscur, Australian_unit);
printf (" Mexico: %f%s\n", maxcur, Mexican_unit);
}
scanf("%f",value);
}
Lisa
That's fine. But don't only rely on me, others might join in,too.
Good luck!
That's fine. But don't only rely on me, others might join in,too.
Good luck!
Dragonmen
Why are you doing this? You are here long enough to know that this is not allowed.
Why are you doing this? You are here long enough to know that this is not allowed.
I missed first part where it says it's an exam. I tought it's a syntax error in the code or something.
I hope the admin will delete this post.
I hope the admin will delete this post.
ASKER
i'm sorry guys this is not an exam just a home work - I don't want any one to do my work for me I just had a question sorry for the inconvenience Lclarius
With a copy & paste you have your solution now. Use it well to learn what you missed :-)
ASKER
Thank you and again I'm sorry ---
Pssst! ... just don't tell anybody
ASKER
do you mine if i resubmit to you for your advice once I complete this ?
Lclarius