I wrote and executed the following code in c++:
int calc(int x=10,int y=100);int a,b,s,p,m;void main()
{clrscr();cout<<"enter the two numbers:";cin>>a>>b;s=calc(a,b);p=calc(a);`m=calc();cout<<"\n sum:"<<s;cout<<"\n product:"<<p;cout<<"\n subtraction:"<<m;getch();}
int calc(int a)
{int t;b=100;t=a*b;return t;}
int calc(int a,int b)
{int t;t=a+b;return t;}
int calc()
{int t;t=b-a;return t;}
I See that only one function is being called and is giving the correct output. For example: 3 and 4 will give 7, but from multiply it will be 101. I am not very good with c++ concepts. An explanation would be useful. Regards.