Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ beginner

Status
Not open for further replies.

EPNICO

MIS
Jun 14, 2001
45
US
I have a small project and I do not know where to start
Here are the specs. A program that will allow the user to enter a shopping list of up to ten items. The user will enter the item name, qty, and aisle # where the item is located. The user will then be able to select either of two options print the entire shopping list sorted by aisle or print all the items needed in a user specified aisle.
Any ideas or help is appreciated.

 
Code:
#include <cstring>
#include <list>
using namspace std;

class COrder
{
  public:
  string sItemName;
  int iQuantity;
  int iAisle;
}

Then you need to overload the <,>,!= and == operators so you cant use the sort() function.

e.g.
Code:
friend bool operator<(const COrder &o1, const COrder &o2);

bool operator<(const COrder &o1, const COrder &o2)
{
  return o1.iAisle < o2.iAisle;
}
This will sort it by aisle.

That gives you a start.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top