One (1) euro is equivalent to fifty five (55) pesos and one (1) dollar is equivalent to 44 pesos. Write a program
that converts dollar to euro. The program should ask the user to input an amount in dollar and display the
equivalent amount in euro. Use a function for the conversion. Allow the user to repeat as often as the user
wants.
#include <bits/stdc++.h>
using namespace std;
void conversion()
{
double dollar, euro;
cout<<"Input an amount in dollar: ";
cin>>dollar;
euro = (dollar * 44) / 55 ;
cout<<"Amount in Euro is: "<<euro<<endl;
}
int main()
{
int a;
cout << "Press 1 for conversion.\nPress 2 for exit the program."<<endl;
cin >> a;
if (a == 1)
{
conversion();
}
else{
exit;
}
}
Comments
Leave a comment