I am trying to build a program that inputs deposits into an array by dollar amount, and displays them back in both dollars and Yen. I successfully built the program in C, but for some reason I can't figure it out in C++. What is wrong here?
Code:
// Evaluate Yen
#include <iostream>
using namespace std;
const int MAX_CURRENCYS = 100; // Max number of Bank Deposits
const float DOLLARS_TO_YEN = 102.2; // 1 Dollar = 102.2 Yen
// Function prototypes
void readDollars ( float Dollars[], int count );
void DollarsToYen ( float Dollars[], float Yen[], int count );
void displayData ( float Dollars[], float Yen[], int count );
int main (void)
{
int nums; // Actual number of deposits
float Dollars[MAX_CURRENCYS]; //Dollars
float Yen[MAX_CURRENCYS]; // Yen
// Prompt the user for the number of deposits.
cout << endl << "\n Enter the number of deposits: ";
cin >> nums;
// Read the amount in each deposit .
readDollars(Dollars,nums);
// Convert Dollars to Yen.
DollarsToYen(Dollars,Yen,nums);
// Display the amount in each deposit
displayData(Dollars,Yen,nums);
return 0;
}
// read number of Dollars in each account from the keyboard
void readDollars ( float Dollars[], int count )
{
int j;
cout << "Enter the dollar amount for each : ";
for ( j = 0; j < count; j++ )
cin >> Dollars[j];
}
//gives number of Yen in each account
void DollarsToYen ( float Dollars[], float Yen[], int count )
{
int j;
for ( j = 0; j < count; j++ );
Yen[j]=Dollars[j]*DOLLARS_TO_YEN;
}
// displays the amount in each account in both Dollars and Yen
void displayData ( float Dollars[], float Yen[], int count )
{
int j;
cout << "\n Dollars Yen \n" << endl;
for ( j=0;j<count;j++)
{
cout << " %7.2f %7.2f \n" << Dollars[j] << Yen[j];
}
}