Question: #include using namespace std; bool eat ( int fi [ ] , int i ) { bool changeDone = false; if ( fi [ i

#include
using namespace std;
bool eat(int fi[], int i)
{
bool changeDone = false;
if (fi[i]>0)
{
fi[i]-=1;
changeDone = true;
}
return changeDone;
}
int main()
{
int foodInventory[5]={10,3,3,2,1};
if (eat(foodInventory,4))
cout "BAM";
else
cout "BOOM";
return 0;
}
what is the output
#include using namespace std; bool eat ( int fi [

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!