+ 2

Write a c++ Program to find the area of square.... Use friend function and constructor and function to find the area also print

Please help me if you can...

26th May 2019, 1:37 PM
Khattab Ali Ghazi
Khattab Ali Ghazi - avatar
11 Answers
+ 17
~ swim ~ Yes,😊 that's right!👍
26th May 2019, 2:08 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 16
Hello, 😊 If you need help you can post the code you are struggling with!  • SEARCH for similar QUESTIONS or ANSWERS before posting  • Include relevant TAGS  • https://www.sololearn.com/post/75089/?ref=app  • https://code.sololearn.com/WvG0MJq2dQ6y/
26th May 2019, 1:46 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 1
~ swim ~ thanks bro.. I get it
26th May 2019, 3:26 PM
Khattab Ali Ghazi
Khattab Ali Ghazi - avatar
0
~ swim ~ I'm stuck.. Can you write a program to understand me?
26th May 2019, 1:58 PM
Khattab Ali Ghazi
Khattab Ali Ghazi - avatar
0
~ swim ~ i will send message for you ok?
26th May 2019, 2:03 PM
Khattab Ali Ghazi
Khattab Ali Ghazi - avatar
0
~ swim ~ #include<iostream> using namespace std ; class square ; class rectangle { int w,l; public : rectangle(int x ,int y ):w(x),l(y) {} int area() { return w*l ; } friend void area ( rectangle r , square s) ; }; class square { int s ; public : square ( int x) : s(x) {} friend void area (rectangle r , square s ) ; }; void area ( rectangle r , square s) { int areaa ; r.areaa=r.w*r.l ; r.areaa= s.s*s.s; } // I HAVE MISTAKES IN THIS FUNCTION ... PLAEASE CORRECT IT void print () { cout<<"rectangle"<<r.area; } int main () { recangle r ( 5,6); square s(5); area (r,s); print() }
26th May 2019, 2:08 PM
Khattab Ali Ghazi
Khattab Ali Ghazi - avatar