Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-09-2004, 12:47 PM   #1 (permalink)
saiz66
Registered User
 
Join Date: May 2004
Posts: 11
saiz66 is on a distinguished road
c++ class question

Hi. I basically have to create a Hospital program. I created a Patient class which holds each of the patient's priority, treatment time and so on. Well I made those variables private and created a getPriority, setPriority methods in public. Those look like this:

void setPriority(int priority);
int getPriority();

That seems to be fine. Then I have to insert into a priority queue, which has already been created by my professor. I have then created a Priority Queue:

PQueue <Patient> PQ;

Ok. then I inserted the patient class into the priority queue:

PQ.Insert(patient[i]);

And this is where I get confused. I want to get the patients with the highest priority and print them out. The function to get the highest priority is:

int DeleteMin ( Etype & E );

I understand that it returns the highest priority in Etype & E where the Etype is class Patient. I tried this:

PQ.DeleteMin(patient[i]);

I am confused. Do I need to create a new class. Anybody can help me out? Thanks in advance!
saiz66 is offline   Reply With Quote
Old 06-09-2004, 05:21 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
C++ as it is does not know what PQueue is.
Therefore I don't know how DeleteMin() is defined. But now I assume that DeleteMin() is a member of PQueue.
__________________
Valmont is offline   Reply With Quote
Old 06-09-2004, 05:52 PM   #3 (permalink)
saiz66
Registered User
 
Join Date: May 2004
Posts: 11
saiz66 is on a distinguished road
huh? Sorry I did not really understand that. DeleteMin is a function to return the highest priority into an Etype & E as a reference. I know how to do this if the Etype was an integer. But I don't know how to return it into my patient's class' set method. If for example I wanted to return the highest priority I would simply just PQ.DeleteMin(int priority); and now the highest priority will be deleted and sent into the integer priority. but my Etype is a class and not an integer. In my class I have a private integer called priority. I have a setPriority and getPriority method basically just setPriority(in priority); I have made a priority queue of Patients which is a class I created. I am confused on what to do next. I want to be able to know which patient has the highest priority and print that out.
saiz66 is offline   Reply With Quote
Old 06-09-2004, 07:43 PM   #4 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Just post the code.
And where do I obtain the PQueue library?
__________________
Valmont is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
c simple question if13121 Standard C, C++ 10 11-01-2004 06:29 AM
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 09:43 PM
simple c question if13121 Standard C, C++ 3 10-18-2004 10:20 PM


All times are GMT -8. The time now is 06:38 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting