need help with completing this calculator C++

Sep 2, 2014 at 5:11am
My calculator works in LXterminal but it needs something to add in it. They said WHILE YOU DIVIDE if the 2nd number is 0, it should say "Sorry you can't divide by zero" (It should only do that when CHOICE is QUOTIENT) I don't know where to add it in this codes HELP

if (choice == quotient)
{
cout << "The quotient is: " << first_number/second_number << "\n";
}

return 0;
}
[/code]
Last edited on Sep 2, 2014 at 6:31am
Sep 2, 2014 at 5:59am
It should only do that when CHOICE is QUOTIENT

I do not understand what is confusing there? Would it not make sense that you would add it after
if (choice == quotient)

Then just nest another if/else like
1
2
3
4
if(second_number == 0)
    cout << "Sorry you can't divide by zero";
else
    // go ahead 
Sep 2, 2014 at 7:11am
i think you are confusing about the QUOTIENT ^^
Topic archived. No new replies allowed.