Modify the following program so that it correctly handles the unfortunate situation when you have a stash of cookies but are out of milk. #include using namespace std; int main() { try { cout >...



Modify the following program so that it correctly handles the unfortunate situation when you have a stash of cookies but are out of milk.


#include
using namespace std;


int main()
{
try
{
cout < "number="" of="" cookies:="">
int cookies;
cin >> cookies;
cout < "glasses="" of="" milk:="">
int milk;
cin >> milk;


if (milk <= 0)="" throw="">


double cpg = cookies / static_cast(milk);
cout < cookies="">< "="">
< milk="">< "="" glasses="" of="">
< "you="" have="" "=""><>
< "="" cookies="" for="" each="" glass="" of="">
}


catch(...)


{
cerr < e="">< "="" cookies,="" and="" no="">
< "go="" buy="" some="">
}
}




Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here