fork(1) download
  1. //@Author Damien Bell
  2. #include <iostream>
  3.  
  4. using namespace std;
  5. int main(){
  6. int choice;
  7. double dollars=0, euro=0; //1: 1.43 --Xe.com/UCC
  8. char Quit= ' ';
  9. while(Quit != 'n'){
  10.  
  11. cout << "Press 1 to convert dollars to Euro, or Press 2 to convert euros to dollars: ";
  12. cin >> choice;
  13.  
  14. if(choice == 1){
  15. cout << "\nEnter how many dollars you want to convert: ";
  16. cin >> dollars;
  17. euro = dollars / 1.43;
  18. cout << dollars << " dollars, converts into: (E)" << euro << endl;
  19. }
  20. if (choice ==2){
  21. cout <<"\nEnter how many euros you want to convert: ";
  22. cin >> euro;
  23. dollars = euro * 1.43;
  24. cout << euro <<" euros, converts into: $" << dollars <<endl;
  25. }
  26.  
  27.  
  28.  
  29.  
  30. cout <<"Do you want to run again? Y/ N ";
  31. cin >> Quit;
  32. }
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 2860KB
stdin
1
143
y
2
100
n
stdout
Press 1 to convert dollars to Euro,  or Press 2 to convert euros to dollars: 
Enter how many dollars you want to convert: 143 dollars, converts into: (E)100
Do you want to run again? Y/ N Press 1 to convert dollars to Euro,  or Press 2 to convert euros to dollars: 
Enter how many euros you want to convert: 100 euros, converts into: $143
Do you want to run again? Y/ N