Currency convertion and future value conversion

Cant get this to run, its supposed to convert dollars to euros,pesos and yen and use the same amount of dollars entered to calculate its future value.
im getting this error>> 144:1: error: expected unqualified-id before '{' token

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
// This program will input American money and convert it to foreign currency
// PLACE YOUR NAME HERE
// Prototypes of the functions
// The general formula to calculate future values is: Future Value (FV) = (PresentValue).(1+r).(t)
void convertMulti(float dollars, float& euros, float& pesos);
void convertMulti(float dollars, float& euros, float& pesos, float& yen);
void futureValue(double pV, double r, double t);
float convertToYen(float dollars);
float convertToEuros(float dollars);
float convertToPesos(float dollars);
//Write the prototype of the futureValue function after this line
// This program takes the amount of dollars entered and calculates its future value
float euros = 1.06;
float pesos = 9.73;
float yen = 124.35;
double pV;
double r = .05;
double t = 5;

int main ()
{

float dollars;

cout << fixed << showpoint << setprecision(2);

cout << " dollars to euros and pesos" << endl;
cin >> dollars;
// Fill in the code to call convertMulti with parameters dollars, euros, and pesos
// Fill in the code to output the value of those dollars converted to both euros and pesos
convertMulti(dollars, euros, pesos);
cout << "Please input the amount of American Dollars you want converted to euros, pesos, and yen" << endl;
cin >> dollars;
convertMulti(dollars, euros, pesos, yen);
// Fill in the code to call convertMulti with parameters dollars, euros, pesos and yen
// Fill in the code to output the value of those dollars converted to euros, pesos and yen
cout << "Please input the amount of American Dollars you want converted\n";
cout << "to yen" <<endl;
cin >> dollars;
convertToYen(dollars);
// Fill in the code to call convertToYen
// Fill in the code to output the value of those dollars converted to yen
cout << "Please input the amount of American Dollars you want converted \n";
cout << " to euros" << endl;
cin >> dollars;
convertToEuros(dollars);
// Fill in the code to call convert ToEuros
// Fill in the code to output the value of those dollars converted to euros
cout << "Please input the amount of American Dollars you want converted \n";
cout << " to pesos " << endl;
cin >> dollars;
convertToPesos(dollars);
// Fill in the code to call convertToPesos
// Fill in the code to output the value of those dollars converted to pesos
//Add the code to ask for r and t here.
//
//Add the core to make the appropriate function call to future value and then show the result.
//
return 0;
}
// All of the functions are stubs that just serve to test the functions
// Replace with code that will cause the functions to execute properly
// **************************************************************************
// convertMulti
//
// task: This function takes a dollar value and converts it to euros
// and pesos
// data in: dollars
// data out: euros and pesos
//
// *************************************************************************
void convertMulti(float dollars, float& euros, float& pesos)
{
cout << dollars << " is converted to " << dollars * euros << " euros, and " << dollars * pesos << " pesos " << endl;
}
// ************************************************************************
// convertMulti
//
// task: This function takes a dollar value and converts it to euros
// pesos and yen
// data in: dollars
// data out: euros pesos yen
//
// ***********************************************************************
void convertMulti(float dollars, float& euros, float& pesos, float& yen)
{
cout << dollars << " is converted to " << dollars * euros << " euros, and " << dollars * pesos << " pesos" << endl;
cout << " and " << dollars * yen << " yen " << endl;
}
// ****************************************************************************
// convertToYen
//
// task: This function takes a dollar value and converts it to yen
// data in: dollars
// data returned: yen
//
// ***************************************************************************
float convertToYen(float dollars)
{
cout << "The dollars entred are converted to" << endl;
cout << dollars * yen << "yen" << endl;
return 0;
}
// ****************************************************************************
// convertToEuros
//
// task: This function takes a dollar value and converts it to euros
// data in: dollars
// data returned: euros
//
// ***************************************************************************
float convertToEuros(float dollars)
{
cout << "The dollars entred are converted to" << endl;
cout << dollars * euros << " Euros" << endl;
return 0;
}
// *****************************************************************************
// convertToPesos
//
// task: This function takes a dollar value and converts it to pesos
// data in: dollars
// data returned: pesos
//
// ****************************************************************************
float convertToPesos(float dollars)
{
cout << "The dollars entred are converted to" << endl;
cout << dollars * pesos << " pesos" << endl;
return 0;
}
// *****************************************************************************
// convertFutureValue
//
// task: This function takes a dollar value and calculates its futurevalue
// data in: dollars
// data returned: dollars
//
//
{
//cin >> pV ;
cout << "Please enter the Present Value:" << endl;
cin >> pV = dollars;
cout << "Formula for future value: " << "(PresentValue).(1+r).(t)" << endl;
futureValue(pV, r, t);



return 0;
}
void futureValue (double pV, double r, double t)
{
cout << "The future value is: " << pV * (1+r) * t << endl;

}
Last edited on
First, please use code tags. See http://www.cplusplus.com/articles/jEywvCM9/
(If you had used tags, we might see where the line 144 is.)

Second. You have a lot of tedious and unnecessary repetition. Consider this:
1
2
3
4
5
void convert( float amount, float rate, const std::string & name )
{
  std::cout << "The dollars entred are converted to\n";
  std::cout << rate * amount << ' ' << name << '\n';
}
Topic archived. No new replies allowed.