Question: I want to draw a clear flowchart for this codes int main() { // Display the calculation int num_1,num_2; // Display the num_1 and num_2
int main()
{
// Display the calculation
int num_1,num_2; // Display the num_1 and num_2
char mathCalculation ='M'||'m'||'D'||'d'||'A'||'a'||'S'||'s'||'L'||'s'; // Display the math calculation
cout << "Enter the num_1:"; // ask the user to input the num_1
cin >> num_1;
cout << "Enter the num_2:"; // ask the user to input the num_2
cin >> num_2;
cout << "For Multiplication:M or m For Division:D or d For Addition:A or a For Subtraction:S or s For modulus:L or ";
cout<<" Enter the math operation:"; // ask the user to input the math calculation
cin >> mathCalculation;
switch(mathCalculation)
{
case 'M':
case 'm':
cout << "Multiplication =" << num_1*num_2;
break;
case'D':
case'd':
cout << "Division =" << num_1/num_2;
break;
case'A':
case'a':
cout << "Addition =" << num_1+num_2;
break;
case'S':
case's':
cout << "Subtraction =" << num_1-num_2;
break;
case'L':
case'l':
cout << "modulus =" << num_1%num_2;
break;
default:
cout << "Error! The calculation is not correct";
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
