![]() |
molim pomoc brzo
evo imam problem sa ovim problem sa ovim programom pa ako mi mozete pomoci javlja neke errore koje ne poznajem jer sam pocetnik pa ako moze pomoc molim sutra program trebam dati frendu pa pllllllllllllllllllllllllllz
#include using namespace std; enum error_code{success,underflow,overflow}; template struct Node{ Node_entry entry; Node *next; Node(); Node(Node_entry item,Node *add_on=NULL); }; template Node next=NULL; } template Node entry=item; next=add_on; } template class Queue{ public: error_code append(const Queue&item); error_code serve(); Queue(); Node *front,*rear; }; template Queue front=rear=NULL; } template error_code Queue::append(const Queue&item){ Node *new_rear=new Node(item); if(new_rear==NULL) return overflow; if(rear==NULL) front=rear=new_rear; else{ rear->next=new_rear; rear=new_rear; } } template error_code Queue::serve(){ if(front==NULL) return underflow; Node *old_front=front; front=old_front->next; if(front==NULL) rear=NULL; delete old_front; return success; } template int Time_Of_packets(int msg_size,int link_speed,int routers,int headrer){ Queue q1; int numberOfLinks=routers+1; int a=(msg_size/2)+header; int b=(msg_size/2)+header; int sum1=0; int sum2=0; int sum; int totalTime=0; int array[numberOfLinks]; for(int i=0;i for(int j=0;j totaTime=1; sum=sum+totalTime; } if(msg_size>link_speed){ totalTime=a/link_speed; q1.append(a); sum1=sum1+totalTime; totalTime=b/link_speed; q1.append(b); sum2=sum2+totalTime; q1.serve(a); q1.serve(b); sum=sum1+sum2; } } return sum; } main(){ int link_speed; int routers; int msg_size; int header; cout<<"enter the size of the msg"< cout<<"enter the number of routers"< cout<<"enter the speed of each link"< cout<<"enter the header size"< int sum=Time_Of_packets(msg_size,link_speed,routers,header); cout<<"the total is "< } evo ovo je orginalni kod sa greskama pa molio bi pomoc brzo. |
#include
enum error_code{success,underflow,overflow}; template struct Node{ Node_entry entry; Node *next; Node(); Node(Node_entry item,Node *add_on=NULL); }; template Node next=NULL; } template Node entry=item; next=add_on; } template class Queue{ public: error_code append(const Queue&item); error_code serve(); Queue(); Node *front,*rear; }; template Queue front=rear=NULL; template error_code Queue::append(const Queue&item){ Node *new_rear=new Node(item); if(new_rear==NULL) return overflow; if(rear==NULL) front=rear=new_rear; else{ rear->next=new_rear; rear=new_rear; } } template error_code Queue::serve(){ if(front==NULL) return underflow; Node *old_front=front; front=old_front->next; if(front==NULL) rear=NULL; delete old_front; return success; } template int Time_Of_packets(int msg_size,int link_speed,int routers,int headrer){ Queue q1; int numberOfLinks=routers+1; int a=(msg_size/2)+header; int b=(msg_size/2)+header; int sum1=0; int sum2=0; int sum; int totalTime=0; int array[numberOfLinks]; for(int i=0;i for(int j=0;j totaTime=1; sum=sum+totalTime; } if(msg_size>link_speed){ totalTime=a/link_speed; q1.append(a); sum1=sum1+totalTime; totalTime=b/link_speed; q1.append(b); sum2=sum2+totalTime; q1.serve(a); q1.serve(b); sum=sum1+sum2; } } return sum; } main(){ int link_speed; int routers; int msg_size; int header; cout<<"enter the size of the msg"< cout<<"enter the number of routers"< cout<<"enter the speed of each link"< cout<<"enter the header size"< int sum=Time_Of_packets(msg_size,link_speed,routers,he ader); cout<<"the total is "< } Još su mi ostala dva errora, ak uspijem riješit, javim! |
Šta bi trebao raditi ovaj program?
|
Sva vremena su GMT +2. Sada je 13:43. |
Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 1999-2024 PC Ekspert - Sva prava pridržana ISSN 1334-2940
Ad Management by RedTyger