Forex Day Trader Review

Tools for Automated Forex Trading.
  • blue
  • red
  • Home
  • Contact us
« Singapore Company Registration for Foreigners / Forex Scalping using Support Resistance, Candlestick Patterns, Trading Channels »

Need help with C programming?

Posted on May 15, 2010 under Foreign Currency Conversion |

/*——————————————————————–
CSS561 Week 5 Assignment
Filename: CurrencyConversionII.c
Author: Scott Fellheimer
Date: 09-12-2009
Facilitator: Zoe (Zina) Likoudis
———————————————————————
Version History
———————————————————————
Version Date
1.00 9-12-2009
——————————————————————–*/

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <system.h> // includes the getch() function

/****************************************************
PURPOSE
This function displays the conversion rates of various currencies to the U.S. Dollar.
—————————————————–
INPUT
fCountryRate - states the exchange rate for that countrys’ currency
—————————————————–
OUTPUT
Visual display of how many U.S. Dollars equals one amount of a foreign currency
****************************************************/

main()

{
//sets the currency rate compared to the U.S. Dollar float variables
float fAustrailia_Rate = 0.833891;
float fCanada_Rate = 0.905396;
float fIndia_Rate = 0.0204600;
float fNewZealand_Rate = 0.129019;
float fUnitedKingdom_Rate = 1.62713;

//sets the functions to be used for currency conversions
float famt_dollars = 0.0;
float famt_foreign = 1.0;
char cDatEffective[]="09/12/2009";

//Set the interger variables
int iCountry;
int iAmount;

// Display Currency Equivalency
printf(" \n\n\t CURRENCY CONVERSION PROGRAM\n");
printf(" \t To Convert Foreign Currency to Equal US Dollar\n");
printf("\t\t Rates as of %s\n\n", cDatEffective);

printf("1.00 Australia Dollar = $%10.6f U.S. Dollars\n", famt_dollars = famt_foreign * fAustrailia_Rate);
printf("1.00 Canada Dollar = $%10.6f U.S. Dollars\n", famt_dollars = famt_foreign * fCanada_Rate);
printf("1.00 Indian Rupees = $%10.6f U.S. Dollars\n", famt_dollars = famt_foreign * fIndia_Rate);
printf("1.00 New Zealand Dollar = $%10.6f U.S. Dollars\n", famt_dollars = famt_foreign * fNewZealand_Rate);
printf("1.00 United Kingdom Pound = $%10.6f U.S. Dollars\n", famt_dollars = famt_foreign * fUnitedKingdom_Rate);

//Display choice options
printf("\n\nEnter 1 to convert the Australia Dollar to U.S. Dollars\n");
printf("Enter 2 to convert the Canada Dollar to U.S. Dollars\n");
printf("Enter 3 to convert the Indain Rupee to U.S. Dollars\n");
printf("Enter 4 to convert the New Zealand Dollar to U.S. Dollars\n");
printf("Enter 5 to convert the United Kingdom Pound to U.S. Dollars\n");
printf("Enter your selection (1 to 5): ");
scanf("%d", &iCountry);

while ( iCountry != 5 ) {
switch (iCountry) {

case 1:

printf("Enter the amount you would like converted to U.S. Dollars\n");
scanf("%d", iAmount);
if ( iAmount >= 1 ) {
printf("$%10.6d Australia Dollars = $%10.6f U.S. Dollars\n",iAmount,famt_dollars = iAmount * fAustrailia_Rate);
}
else {
printf("You have enetered an invalid entry. Please enter a number greater than 0\n")
}
break;
case 2:

printf("Enter the amount you would like converted to U.S. Dollars\n");
scanf("%d", iAmount);
printf("$%10.6fi Canada Dollars = $%10.6f U.S. Dollars\n",iAmount,famt_dollars = iAmount * fCanada_Rate);

// the following lines prevent the console screen from immediately closing until the user presses a key
fflush(stdin);
printf("\nHave a great day!…please press any key to terminate this program…");
getch();

break;
case 3:

printf("Enter the amount you would like converted to U.S. Dollars\n");
scanf("%d", iAmount);
printf("$%10.6fi Indain Rupees = $%10.6f U.S. Dollars\n",iAmount,famt_dollars = iAmount * fIndia_Rate);

// the following lines prevent the console screen from immediately closing until the user presses a key
fflush(stdin);
printf("\nHave a great day!…please press any key to terminate this program…");
getch();
break;
case 4:

printf("Enter the amount you would like converted to U.S. Dollars\n");
scanf("%d", iAmount);
printf("$%10.6fi New Zealand Dollars = $%10.6f U.S. Dollars\n",iAmount,famt_dollars = iAmount * fNewZealand_Rate);

// the following lines prevent the console screen from immediately closing until the user presses a key
fflush(stdin);
printf("\nHave a great day!…please press any key to terminate this program…");
getch();
…multiple problems I need help with

1- I can not get the program to work with the ‘if/else’ function
2- Program will not terminate if option 1-5 are selected
3- How do I get the program to loop from 1)option 1-5 not being selected and going through the default to ’scanf("%d", &iCountry);’ and go back into the ‘while’ statement
4. When entering a number to convert, it does not use it. Where is the numbers coming from that the program is using?

HELP

1 - I don’t see this problem. I did have to add 2 closing ‘}’ to get it to compile. Not sure if Yahoo dropped those. Check where your opening and closing brackets are. Make sure they make sense.

2 - while ( iCountry != 5 ) { says to loop until user selects option 5. But option 5 is UK to US. You should have another option, 9 maybe for exit.

3 - You have the start of the while loop in the wrong place. It should be before you print the menu, so that you always print the menu again as part of the loop.

4 - This is a common C error: When you use scanf, you have to pass it the ADDRESS of the variable want the result put. What you want is:
scanf("%d", &iAmount); // Add the & before iAmount for ‘address of’

Once you fix #4, the rest is just getting the loop right, I think. Everything else looks good.

 Mail this post

Related Posts

  • Make Me a Millionaire by Tim Bekker - Massive Conversions (Aug 16, 2011)
  • Aquaponics 4 You ~ 7.39% Conversions (Jun 29, 2011)
  • Ultimate Guide To Canning And Preserving - Killer Conversions! (May 26, 2011)
  • Become A Game Tester, Highest Conversions In Niche, Highest Payout (Apr 17, 2011)
  • IllusionMage.com 3d Animation - $52.67 Per Sale + 6% Conversions (Mar 19, 2011)

One Response to “Need help with C programming?”

  1. Ratchetr Says:
    September 13th, 2009 at 6:15 pm

    1 - I don’t see this problem. I did have to add 2 closing ‘}’ to get it to compile. Not sure if Yahoo dropped those. Check where your opening and closing brackets are. Make sure they make sense.

    2 - while ( iCountry != 5 ) { says to loop until user selects option 5. But option 5 is UK to US. You should have another option, 9 maybe for exit.

    3 - You have the start of the while loop in the wrong place. It should be before you print the menu, so that you always print the menu again as part of the loop.

    4 - This is a common C error: When you use scanf, you have to pass it the ADDRESS of the variable want the result put. What you want is:
    scanf("%d", &iAmount); // Add the & before iAmount for ‘address of’

    Once you fix #4, the rest is just getting the loop right, I think. Everything else looks good.
    References :

Leave a Reply

Categories

  • Currency Trading Software
  • Currency Trading Tool
  • Foreign Currency Conversion
  • Foreign Currency Exchange
  • Forex Day Trade Review
  • Forex Trading Software
  • Forex Trading Tool

Pages

  • Contact us

Tags

"currency 4X automated best british broker Business CNN Corporate day daytrading dollar Emini euro exchange finance foreign forex forex trading free futures FX How Investing Investment learn Make market money News online review S&P signals software" stock Stocks strategy system systems technical trade trader trading Training

Archives

  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • August 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008

Forex and Other Resources

  • Birds of the World Online
  • Make money with dropshipping.
  • Unique Free Articles - Internet Marketing Articles

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Meta

  • RSS
  • Comments RSS
  • Wordpress Themes

Search

Theme by Theme by http://www.thestuccocompany.com/