Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. int main() {
  4.     char x, a; double f, i, r; std::string operation;
  5.     std::cout << "If you want to conversion of foots in inches then write f" << "\n" << "If you want to conversion of inches in foots then write i" << std::endl;
  6.     do {
  7.         std::cout << "What operation do you want to do ? " << std::endl;
  8.         std::cin >> x;
  9.         if (x == 'f') {
  10.             std::cout << "How many foots?" << std::endl;
  11.             std::cin >> f;
  12.             r = f * 12;
  13.             std::cout << "In " << f << " foots " << r << " iches" << std::endl;
  14.         }
  15.         else if (x == 'i') {
  16.             std::cout << "How many iches?" << std::endl;
  17.             std::cin >> i;
  18.             r = i / 12;
  19.             std::cout << "In " << i << " iches " << r << " foots" << std::endl;
  20.         }
  21.         else { std::cout << "You didn't write what operation do you want to do. Try again." << std::endl; }
  22.         std::cout << "Continue? (y or n)" << std::endl;
  23.         std::cin >> a;
  24.     } while (a = 'y' || a!='n');
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement