I got this compiling but I'm getting no values in my output. Can anyone help out and tell me what I'm doing wrong.
Code:
#include <stdio.h>
#include <time.h>
#define SIZE 5
/* function prototypes */
double convert(int money);
int main()
{
/* variable and array declarations */
int money;
srand( time(NULL));
float xchange[] = { 1.00, 1.3593, 1.0013, 83.1300, 1.5837, rand(time)%100 };
/*
* As of January 30, 2011, the current exchange values from www.google.com/finance.
* USD (United States Dollar) = 1.00
* EUR (Euro Dollar) = 1.3593
* CAD (Canadian Dollar) = 1.0013
* JPY (Japanese Yen) = 83.1300
* GBP (Great Britian Pound) = 1.5837
* DDS (Davidian Dollar Standard) = 3.56
*/
/* prompt the user to enter a US dollar amount */
printf( "Please enter the number of US dollar to be converted:\n" );
scanf("%d.2f", money);
convert(money); /* function call */
return 0; /* indicates successfull termination */
} /* end main function */
/* function prototypes */
double convert(int money)
{
int *Ptr0, *Ptr1, *Ptr2, *Ptr3, *Ptr4, *Ptr5;
int USD, EUR, CAD, JPY, GBP, DDS;
Ptr0 = &USD;
Ptr1 = &EUR;
Ptr2 = &CAD;
Ptr3 = &JPY;
Ptr4 = &GBP;
Ptr5 = &DDS;
/* print the converted foreign currencies to the screen */
*Ptr0 = 1.00 * money; /* USD */
printf( "The total amount in US dollars: %8.2f\n", &USD);
*Ptr1 = 1.3593 * money; /* EUR */
printf( "The total amount in Euro dollars: %8.2f\n", &EUR);
*Ptr2 = 1.0013 * money; /* CAD */
printf( "The total amount in Canadian dollars: %8.2f\n", &CAD);
*Ptr3 = 83.1300 * money; /* JPY */
printf( "The total amount in Japanese Yen: %8.2f\n", &JPY);
*Ptr4 = 1.5837 * money; /* GBP */
printf( "The total amount in British Pounds: %8.2f\n", &GBP);
*Ptr5 = rand(time)%100 * money; /* DDS */
printf( "The total amount in Davidian dollars: %8.2f\n", &DDS);
return 0; /* indicates successful termination */
} /* end function money */
Code:
My output:
Please enter the number of US dollar to be converted:
1
The total amount in US dollars: 0.00
The total amount in Euro dollars: 0.00
The total amount in Canadian dollars: 0.00
The total amount in Japanese Yen: 0.00
The total amount in British Pounds: 0.00
The total amount in Davidian dollars: 0.00