Answer:
Check the explanation
Step-by-step explanation:
Here is the program with function definition and two sample calls.
Code:
#include <iostream>
using namespace std;
//checkMe FUNCTION which takes values a, b and c
void checkMe(char &a, int &b, int &c)
{
//if sum of b and c is negative and a is 'n', b and c are set to 0, otherwise a is set to 'p'
if((b+c)<0 && a=='n')
{
b = 0;
c = 0;
}
else
{
a = 'p';
}
}
int main()
{
//first test case when else part is executed
char a = 'n';
int b = 5;
int c = 6;
checkMe(a, b, c);
cout<<a<<" "<<b<<" "<<c<<endl;
//second test case when if part is executed
a = 'n';
b = -4;
c = -5;
checkMe(a, b, c);
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}
Kindly check the Output below: