CPP structs are more powerful than C structs as they are just classes with public data members. Here, we will create objects of a rectangle struct and find the maximum area of a rectangle.
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line contains N denoting the number of rectangle objects to be created. The next line contains 2*N elements denoting the length and breadth of N rectangles.
For each testcase, in a new line, print the maximum area.
Since this is a function problem, you don't need to take any input. Just complete the area and maxArea functions.
1 <= T <= 100
1 <= length <= 100
1 <= breadth <= 100
9 8 7 6 5 4 3 2
Testcase1: We have N=4, so 4 rectangle objects.
Obj1 (9,8), Obj2(7,6), Obj3(5,4), Obj4(3,2)
Now area is length*breadth. So 9*8=72 gives maxArea
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.