+ 1

Please let me know where are the mistakes made I'll rectify them

#include<iostream> using namespace std; int perimeter_rectangle (int, double, double); // Prototype int main () { int length,breadth,answer, side = 2; cout<<"Enter the Length"; cin >> length; cout<<"\nEnter the Breadth"; cin >> breadth; answer = perimeter_rectangle ( side,length, breadth); // call cout<<"\nThe perimeter of the rectangle with length" << length <<"and" << "breadth" << breadth << "is" << answer; return 0; } int perimeter_rectangle (int x, int y, int z) { return (x* (y+z)); }

23rd Nov 2019, 4:23 AM
Dipanjan Basu
Dipanjan Basu - avatar
3 Antworten
+ 1
Dipanjan Basu Error in prototype. Edit:You have used double in the prototype but you are using only integer in the function.
23rd Nov 2019, 4:29 AM
Avinesh
Avinesh - avatar
+ 1
It should be all int, since you have have declared all variables as int. See the first line inside main().
23rd Nov 2019, 5:11 AM
Avinesh
Avinesh - avatar
0
So the prototype should be int perimeter_rectangle ( double, double, double) ; the rest code is fine?
23rd Nov 2019, 5:08 AM
Dipanjan Basu
Dipanjan Basu - avatar