Given the following variable declarations and function prototype. How do I write three different calling statement to the MyFunction function without declaring additional variable.

int I; bool B; double D;
double MyFunction (bool, int&);

Recommended Answers

All 6 Replies

There's only one way I know of D = MyFunction(B, I); I suppose you could do something like this too, but it seems sort of silly.

D  = Myfunc(false, I);
D = MyFunc(true,I);

> How do I write three different calling statement to the MyFunction function
> without declaring additional variable.
what kind of question is this? the second parameter must be I. there are an infinite number of ways in which the first parameter could be a bool.

MyFunction ( B, I ) ;
MyFunction ( I, I ) ;
MyFunction ( D, I ) ;
MyFunction ( D>I, I ) ;
MyFunction ( B && (D==I), I ) ;
MyFunction ( I+I, I ) ;
// ...

I think it can be call in diff.. ways as follows:----

1) D = MyFunction(B, I);
2) B= MyFunction(D, I);

3rd Also I dont know
Above two may b correct if wrong then tell how?
:?:

need THREE different and valid calling statements

YOUR assignment.

[sacarsm]Oh I didn't know that[/sacarsm]

commented: *plonk* -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.