DaRedMonkey
IS-IT--Management
The following program give me these error:
ompiling...
AnyCurrency2US.cpp
E:\DVN\UOP\POS370\Week3\Currency_Conversion\AnyCurrency2US.cpp(61) : error C2440: '=' : cannot convert from 'char [4]' to 'char [20]'
There is no context in which this conversion is possible
E:\DVN\UOP\POS370\Week3\Currency_Conversion\AnyCurrency2US.cpp(65) : error C2440: '=' : cannot convert from 'char [5]' to 'char [20]'
There is no context in which this conversion is possible
E:\DVN\UOP\POS370\Week3\Currency_Conversion\AnyCurrency2US.cpp(69) : error C2440: '=' : cannot convert from 'char [9]' to 'char [20]'
There is no context in which this conversion is possible
E:\DVN\UOP\POS370\Week3\Currency_Conversion\AnyCurrency2US.cpp(73) : error C2440: '=' : cannot convert from 'char [15]' to 'char [20]'
There is no context in which this conversion is possible
E:\DVN\UOP\POS370\Week3\Currency_Conversion\AnyCurrency2US.cpp(77) : error C2440: '=' : cannot convert from 'char [18]' to 'char [20]'
There is no context in which this conversion is possible
Error executing cl.exe.
Currency_update_proj.exe - 5 error(s), 0 warning(s)
==================================
void main(void)
{
// Variable declaration
const double JPY_Rate = 117.70; // Rate to convert YEN (JPY) to US Dollar
const double EUR_Rate = 1.021; // Rate to convert EURO (EUR) to US Dollar
const double CAD_Rate = 1.559; // Rate to convert Canadian Dollar (CAD) to US Dollar
const double GBP_Rate = 0.652; // Rate to convert Pounds Stering (GBP) to US Dollar
const double AUD_Rate = 1.833; // Rate to convert Australia Dollar (AUD) to US Dollar
bool Continue = true; // Flag use to determine if the user want to do another conversion
char Cont; // Holds choice to continue or not
bool Error = false; // Flag to respond to invalid input
char Choice = ' '; // Value to hold the choice of currency
char CurrencyName[20]; // Holds the long name of the currency
double CurrencyRate; // Holds the exchange value fora particular currency
double OrigAmount; // The amount entered by use to convert to USD
double ConvertedAmount; // The amount in USD after the conversion
while( Continue ){
// Display Title
cout << "\tC U R R E N C Y C O N V E R S I O N" << endl;
cout << "\t_____________________________________" << endl << endl;
// Prompt for Input
cout << "What currency would you like to convert to US Dollars?" << endl;
cout << "\tY for YEN" << endl;
cout << "\tE for Euro" << endl;
cout << "\tC for Canadian" << endl;
cout << "\tB for British Pounds" << endl;
cout << "\tA for Australian dollar" << endl;
cout << "What's your choice Y, E, C, B, or A ? " << endl << endl;
cin >> Choice;
// Setup the appropriate currency type and rate
switch(Choice){
case 'Y':
CurrencyName = "Yen";
CurrencyRate = JPY_Rate;
break;
case 'E':
CurrencyName = "Euro";
CurrencyRate = 1.021;
break;
case 'C':
CurrencyName = "Canadian";
CurrencyRate = JPY_Rate;
break;
case 'B':
CurrencyName = "British Pounds";
CurrencyRate = JPY_Rate;
break;
case 'A':
CurrencyName = "Australian dollar";
CurrencyRate = JPY_Rate;
break;
default:
Error = true;
}
if ( Error == false ){
// Ask user for amount to be converted
cout << "Please enter the amount in " << CurrencyName << " to convert into US Dollars ? ";
cin >> OrigAmount;
// Perform conversion
ConvertedAmount = OrigAmount * CurrencyRate;
// Print out result of conversion
cout << "As of 08/15/02 : " << OrigAmount << " of " << CurrencyName << " is equivalent to";
cout << ConvertedAmount << " US Dollar(s)." << endl << endl;
} else {
cout << "Error: The choice you have entered is not valid." << endl;
}
cout << "Do you want to do try another conversion (Y or N)? " << endl;
cin >> Cont;
}
if ( Cont = 'N' ) {
Continue = false;
cout << "Enter any key to exit ...";
getch();
}
} // End Main