Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Help on exchange rate project

$
0
0
the purpose of this project is simple it prompts the user to input the current exchange rate between U.S dollars and Japanese yen then it prompts the user to enter the amount of dollars he or she wants to convert to yen. It does the calculations right but how do i get it to only ask for the exchange rate once...and also when i enter "0 and "enter"" i have to do it twice to calculate any advice on how to fix the problem?


#include<iostream>

using namespace std ;

int main ()

{
    double exchange_rate = 0 ;
    double dollar = 0 ;
    bool more = true ;
    
    while (more)
    {
       
        double input_er ;
        cout<< " Please enter U.S dollar to Japanese yen \n exchange rate \n Example 1 dollar is equal to ___ yen \n" ;
        cin>> input_er ;
        
        double input_dollar ;
        cout<< " Enter the ammount of dollars you wish to convert to yen \n" ;
        cout<< " Enter the value 0 to calculate \n" ;
        cin>> input_dollar ;
        
        if ( input_dollar == 0)
            more = false ;

        else
        {
            exchange_rate = input_er ;
            dollar = dollar + input_dollar ;
            
        }
    
    }
    
        if (dollar > 0)
             cout<< " You Have " << dollar * exchange_rate << " Yen \n" ;
        
        return 0 ;

        
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>