0
while loop using continue
Find double or triple or half of a number and make a menu to continue using do while
1 Resposta
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');
}