hello there! i'm new n i need real help!
i got this homework and i have to have it done before tomorrow! i tried so hard n i cried all the last night *cries again* i hate queues!!!!!
anyway plz help me if u can. i have to write 3 programs in C++:
1- insert elements to a priory queue.
2- copying a queue to another using a third queue.
3- generate random numbers between 0~100, and inserting the 50 even numbers in queue A and insert the 50 odd numbers in queue B.

PLEASEEEEEEEEEE HEEEEEEEEEEEEEEEEEEELP

http://www.catb.org/~esr/faqs/smart-questions.html#urgent
Sorry, but we're only able to help people who show up with code and a reasonable amount of time to be able to do something about it.

Showing up with nothing to show except some tale of how much life sucks and how useless you are are programming, dumping your assignment, and expecting some last minute "hail mary" pass to save you is just not going to happen.

We're here to help you understand, not a rescue service for your procrastination.

Take your 'F', then come back with the next assignment (and some effort) in plenty of time, then we'll be able to help you.

ok can u at least tell me if this code is alryt, or if i can write in a better way?
#include<iostream.h>
#include<stdlib.h>
const int size=10;
class PQueue{
private:
int QA;
int item;
public:
PQueue();
int empty_queue(), PQdelete(), full_PQueue();
void PQInsert();};
int PQueue::empty_PQueue(){
return item==0;}
PQueue::PQueue():item(0){}
int PQueue::full_PQueue(){
return item=size;}
int PQueue::PQdelete(){
if(item==0){
cout<<\nError: Deleting from an empty queue";
getch();
exit(1);}
return PQueue_list;}
void PQueue::PQInsert(int x){
if (item==size){
cout<<"\nError: Queue is full\n";
getch();
exit(1);}
int j;
if (item==0)
PQueue_list[item++]=item;
else{
for(j=item-1; j>=0; j--){
if(x>PQueue_list[j])
PQueue_list[j+1]=PQueue_list[j];
else
break;}
PQueue_list[j+1]=item;
x++}}
void main(){
PQueue PQ1;
randomize();
cout<<"\n\nOriginal Queue";
int rndd;
for (int i=0; i<size; i++){
rndd=rand()%100;
PQ1.PQInsert(rndd);
cout<<"\nQ["<<(i+1)<<"] :"<<rndd;
}
cout<<"\n\nPriority Queue";
int j=1;
while (!PQ1.empty_PQueue()){
int i=PQ1.PQDelete();
cout<<"\nPQ["<<(j++)<<"] :"<<i;
}
getch();}

sry for the smilys!
smily = : P

struct p_queue{
int front,rear;
int list[50];
int priority;
};
you got to use enqueue function keeping in mind the pririty value.
you can create 2 queues by declaring
struct p_queue a;
struct p_queue b;
next time be more precise

There wouldent be smilies if you had used code tags .. :icon_wink:
And stop complaining, I personally would really like to have programming lessons at school, and I wouldent leave something like this to the last minute.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.