Make a program that will input Philippine currency (Peso), convert it into Dollar. 1 Dollar 49.50 pesos, Display the Dollar equivalent. Your program will be terminated if the peso currency = 0.
#include <iostream>
int main()
{
const double rates = 49.50;
double dollar;
std::cout << "This program converts dollars to pesos" << "\n";
std::cout << "Enter 0 to complete the conversion process" << "\n";
std::cout << "Current exchange rate: 1 Dollar = " << rates << " Pesos" << "\n";
for (;;)
{
std::cout << "Enter the amount of dollars: ";
std::cin >> dollar;
if (dollar == 0)
break;
if (dollar < 0)
std::cout << "Negative value entered" <<"\n";
else
std::cout << dollar <<" Dollars = " << dollar*rates<< " Pesos" << "\n";
}
return 0;
}
Comments
Leave a comment