0

while loop using continue

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

16th Aug 2016, 6:00 AM
Zafirah Mohamed iqbal
Zafirah Mohamed iqbal - avatar
1 Antwort
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'); }
18th Aug 2016, 1:43 AM
Ahkrin