Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- char x, a; double f, i, r;
- 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;
- do {
- while (true) {
- std::cout << "What operation do you want to do ? " << std::endl;
- std::cin >> x;
- if (x == 'i' || x == 'f') { break; }
- else {
- std::cout << "You didn't enter operation. Try again." << std::endl;
- continue;
- }
- }
- if (x == 'f') {
- std::cout << "How many foots?" << std::endl;
- std::cin >> f;
- r = f * 12;
- std::cout << "In " << f << " foots " << r << " iches" << std::endl;
- }
- else if (x == 'i') {
- std::cout << "How many iches?" << std::endl;
- std::cin >> i;
- r = i / 12;
- std::cout << "In " << i << " iches " << r << " foots" << std::endl;
- }
- while (true) {
- std::cout << "Continue? (y or n)" << std::endl;
- std::cin >> a;
- if (a == 'y' || a == 'n') {break;}
- else {
- std::cout << "You didn't answer. Try again." << std::endl;
- continue;
- }
- }
- } while (a == 'y' || a!='n');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement