#include <iostream> using namespace std; int calc(int &a,int &b,int c=6) { a+=b; b-=c; c=a+b; } int main() { int calc(int,int,int); int x=2,y=3,z=4; cout<<x<<endl<<y<<endl<<z<<endl; calc(x,y,z); cout<<x<<endl<<y<<endl<<z<<endl; calc(5,6,z); cout<<x<<endl<<y<<endl<<z<<endl; return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

#include <iostream> using namespace std; int calc(int &a,int &b,int c=6) { a+=b; b-=c; c=a+b; } int main() { int calc(int,int,int); int x=2,y=3,z=4; cout<<x<<endl<<y<<endl<<z<<endl; calc(x,y,z); cout<<x<<endl<<y<<endl<<z<<endl; calc(5,6,z); cout<<x<<endl<<y<<endl<<z<<endl; return 0; }

what's wrong with the program its showing error

22nd Sep 2016, 7:34 PM
Asim
Asim - avatar
5 Answers
+ 2
the calc function is declared and defined as int but returns nothing...try using void..
24th Sep 2016, 4:19 PM
Balaji Rs
Balaji Rs - avatar
0
jfhwekhfkw
12th Feb 2019, 3:52 PM
Aniket
0
this is hard where are the answers
7th Feb 2020, 5:10 PM
William Bradley
William Bradley - avatar
- 1
Remove the "int calc(int,int,int);" line. Also, "calc(5,6,z);" will give you an error since calc need variables for the first two parameters.
22nd Sep 2016, 7:57 PM
Zen
Zen - avatar
- 1
nope it shows error when ever I use & symbol can u show me any function having &
23rd Sep 2016, 1:53 AM
Asim
Asim - avatar