C Sort Function Include Using Namespace Std Struct Rectangle Int Height Int Width Int Are Q37178269

C++.

Sort function only!

#include <iostream>

using namespace std;

struct Rectangle

{

int height;

int width;

int area = height * width;

};

struct ListNode

{

Rectangle rect;

ListNode *next = nullptr;

int area;

ListNode(int h, int w)

{

rect.height = h;

rect.width = w;

area = rect.height * rect.width;

};

};

void display(ListNode* head)

{

/// TO DO: Add your code here

  

/// If the list is empty, it should display a message to let theuser knows about it.

if(head == nullptr)

{

cout << “The list is empty.” << endl;

}

else if (head != nullptr && head->next ==nullptr)

{

cout << “(” << head->rect.height << “, “<< head->rect.width << “)” << endl;

}

else

{

while(head != nullptr)

{

cout << “(” << head->rect.height << “, “<< head->rect.width << “)->”;

head = head->next;

}

cout << “@” <<

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.