0

What is the error in this will any one correct this code pls .

#include <iostream> #include <math.h> using namespace std; int area (int); float area (float, float); float area (float, float, float); int main() { int side; float 1,w, si, s2, s3; cout <<endl<< "Enter side of a Square: "; cin>> side; cin>> l >>w; cin>> s1 >> s2 >> 53; cout <<endl<< "Enter length and width of a rectangle:"; cout <<endl<< "Enter three sides of a triangle: "; cout <<endl<< "Area of a Square= "; <<area (side); cout <<endl<< "Area of a Rectangle= "; <<area (1,w); cout <<endl<< "Area of a triangle= "; <<area (s1, s2, s3); return 0; } int area (int a) { return (a*a); } float area (float i, w) { return (1*w); } float area (float si, float s2, float s3) { float s, a; s = (a + b + c)/2; a = sqrt (s * (s - sl) * (s - s2) * (s - s3); return (a);

23rd Mar 2022, 12:21 PM
Mohammad Rehan Glasswala
3 Answers
+ 1
#include <iostream> #include <math.h> using namespace std; int area(int); float area (float, float); float area (float, float, float); int main() { int side; float l,w, s1, s2, s3; //1 cout << "Enter side of a Square: "; cin >> side; cout<<endl<< "Area of a Square= "<< area(side); //2 cout <<endl<<"\nEnter length and width of a rectangle:"; cin>> l >> w; cout <<endl<<"Area of a Rectangle= "<<area(l,w); //3 cout<<endl<<"\nEnter three sides of a triangle:"; cin>> s1 >> s2 >> s3; cout <<"\nArea of a triangle= "<<area(s1,s2,s3); //4 return 0; } int area(int a) { return a*a; } float area(float l, float w) //5 { return l*w; } float area(float s1, float s2, float s3) { float s, a; s = (s1 + s2 + s3)/2; //6 a = sqrt (s * (s - s1) * (s - s2) * (s - s3)); //7 return a; } //just compare with your program, you can find correction made. added // where I changed //share code link by saving .. hope it helps....
23rd Mar 2022, 2:55 PM
Jayakrishna 🇼🇳
+ 4
You have too many errors, so try to build it again: "write one command - check its performance and only then write the next command". Happy coding. â˜ș #include <iostream> #include <math.h> using namespace std; int area(int a) { return (a*a); } /* float area (float, float); float area (float, float, float); */ int main() { int side; //float 1,w, si, s2, s3; cout <<endl<< "Enter side of a Square: "; cin >> side; //cin>> l >>w; //cin>> s1 >> s2 >> 53; //cout <<endl<< "Enter length and width of a rectangle:"; //cout <<endl<< "Enter three sides of a triangle: "; cout <<endl<< "Area of a Square= " << area(side); //cout <<endl<< "Area of a Rectangle= "; <<area (1,w); //cout <<endl<< "Area of a triangle= "; <<area (s1, s2, s3); return 0; } /* float area (float i, w) { return (1*w); } float area (float si, float s2, float s3) { float s, a; s = (a + b + c)/2; a = sqrt (s * (s - sl) * (s - s2) * (s - s3); return (a); }*/
23rd Mar 2022, 12:34 PM
Solo
Solo - avatar
+ 2
Pls save code and share link. This may help you, to share links 👇 https://www.sololearn.com/post/75089/?ref=app edit : Rehan Glasswala is it l or 1 in you code for variable height. you have a typo there. and you are missing float area(int l, int w) { //here missing type for w .. }
23rd Mar 2022, 12:32 PM
Jayakrishna 🇼🇳