Advertisement
J2112O

Untitled

Mar 18th, 2015
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.42 KB | None | 0 0
  1.  // Money Converter                                                                                            
  2.   2 #include <iostream>                                                                                          
  3.   3 using namespace std;                                                                                          
  4.   4 int main()                                                                                                    
  5.   5 {                                                                                                            
  6.   6     const double euros_per_dollar = 0.95 , yens_per_dollar = 121.34;                                          
  7.   7                                                                                                              
  8.   8     double dollars = 0;                                                                                      
  9.   9                                                                                                              
  10.  10     //char unit =  '\0';                                                                                      
  11.  11     cout << "Please enter the amount of dollars you wish to convert: \n";                                    
  12.  12     cin >> dollars;                                                                                          
  13.  13                                                                                                              
  14.  14     string yens;                                                                                              
  15.  15     string euros;                                                                                            
  16.  16     cout << "Do you wish to convert yens or euros? \n";                                                      
  17.  17     string input;                                                                                            
  18.  18     cin >> input;                                                                                            
  19.  19     cout << "You entered: "<< input <<  '\n';                                                                
  20.  20     if(input == yens)                                                                                        
  21.  21         {                                                                                                    
  22.  22             cout << "The amount of yens you have is: " << dollars*yens_per_dollar << '\n';                    
  23.  23         }                                                                                                    
  24.  24                                                                                                              
  25.  25     if(input != yens)                                                                                        
  26.  26         {                                                                                                    
  27.  27             cout << "The amount of euros you have is: " << dollars*euros_per_dollar << '\n';                  
  28.  28         }                                                                                                    
  29.  29                                                                                                              
  30.  30                                                                                                              
  31.  31     return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement