Answer:
Check the explanation
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:
<span>You can delete any content control by Right Clicking it, and then clicking remove content control on the menu that opens.</span>
What is it about ? And what you need help on
Answer:
The statement is as follows:
cout <<fixed<< setprecision(3) <<sales;
Explanation:
Here, I assume that the variable has already been declared.
The syntax to use is:
cout<<fixed<<setprecision(n)<<variable-name;
In this case:
--- i.e. to 3 decimal places
And the variable name is: sales
So, when implemented, the instruction is:
cout <<fixed<< setprecision(3) <<sales;
Explanation:
it looks like there aren't many great matches for your search
Tip Try using words that might appear on the page that you’re looking for. For example, 'cake recipes' instead of 'how to make a cake'.
I hope you help