fork download
  1. #include <iostream>
  2. #include <limits>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. double pounds, kg;
  8. char option;
  9.  
  10. cout << "WEIGHT CONVERSION OPTIONS \n" << " " << "A) KG to pounds: \n" << " " << "B) Pounds to KG: \n " <<"Enter option A or B: \n";
  11. cin.get(option);
  12.  
  13. if(option == 'A') {
  14. cout << "Enter a weight in lbs: ";
  15. cin >> pounds;
  16. kg = pounds*2.2046;
  17. cout << "Your weight in kg is: " << kg;
  18. }
  19. else if(option == 'B') {
  20. cout << "Enter a weight in kg: ";
  21. cin >> kg;
  22. pounds = kg/2.2046;
  23. cout << pounds;
  24.  
  25. }
  26. std::cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
  27. std::cin.get();
  28. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty