0

what is the wrong here

#include <iostream> using namespace std; double avg(int m1, int m2, int m3) { double avg=0; avg=(m1+m2+m3)/3; return (avg); } int main() { int m1,m2,m3; cin>>m1>>m2>>m3; cout<<"the avardge = "<<avg((m1,m2,m3)/3); return 0; }

27th Aug 2019, 6:23 PM
Mahmoud Hamed
Mahmoud Hamed - avatar
4 Answers
+ 3
1) Functions and variables names cannot be same. 2) When calling function, you only need to pass specified arguments. In your cout statement, function call should be like avg(m1, m2, m3). Change either function name or variable name in your own defined function.
27th Aug 2019, 6:54 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
Nose carnal :v
27th Aug 2019, 6:28 PM
Jaciel Higuera
Jaciel Higuera - avatar
+ 1
thank you alot nAutAxH AhmAd
27th Aug 2019, 6:57 PM
Mahmoud Hamed
Mahmoud Hamed - avatar
0
Jaciel Higuera i do not understand what u have said
27th Aug 2019, 6:29 PM
Mahmoud Hamed
Mahmoud Hamed - avatar