while loop using continue | SoloLearn: Learn to code for FREE!

0

while loop using continue

Find double or triple or half of a number and make a menu to continue using do while

8/16/2016 6:00:05 AM

Zafirah Mohamed iqbal

1 Answer

New Answer

0

#include <iostream> void main() { char c; double num = 0; do { std::cout << "Enter d to double; t to triple; h to half; or e to exit: "; std::cin >> c; std::cout << "Enter a number to affect: " ; std::cin >> num; switch (c) { case 'd': std::cout << num*2; break; case 't': std::cout << num*3; break; case 'h': std::cout << num/2; break; }; } while (c != 'e'); }