C++ Programming - Functions - Discussion
Discussion Forum : Functions - Programs (Q.No. 8)
8.
What will be the output of the following program?
#include<iostream.h>
struct MyData
{
public:
int Addition(int a, int b = 10)
{
return (a *= b + 2);
}
float Addition(int a, float b);
};
int main()
{
MyData data;
cout<<data.Addition(1)<<" ";
cout<<data.Addition(3, 4);
return 0;
}
Discussion:
14 comments Page 2 of 2.
Dinesh said:
1 decade ago
I can't understand why a=18 for 3*=6? Please clarify me.
Hema said:
9 years ago
Anyone explain this properly, how additional (1,10)?
Shriya Kar said:
8 years ago
Thank you for your explanation @Mayur.
(1)
Rashmila said:
1 decade ago
Why the answer is not 12 and 14?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers