Results 1 to 2 of 2
Thread: ++
Hybrid View
-
23rd February 2011 09:03 #1Registered User
Join Date: Feb:2011
Location:
Posts: 1
++
:
char , int . . Q 3,1,5,8,6 .Code:#include<iostream.h> #include<conio.h> typedef mass [100]; struct queue { char inf; queue *next; }; struct stack { char ini; stack *nexi; }; queue *p,*q; stack *a; char empty_queue(queue* &p) { return p==NULL; } char empty_stack(stack *&a) { return a==NULL; } void create_empty_queue(queue* &p,queue* &q) { p=q=NULL; } stack *create_stack() { return NULL; } void put_el(char x,queue* &p,queue* &q) { queue *r; r=new queue; r->inf=x; r->next=NULL; if(empty_queue(p)) p=r; else q->next=r; q=r; } void put_el2(char x, stack *&a) { stack *q; q=new stack; q-> ini=x; q-> nexi=a; a=q; } void create_queue(queue* &p,queue* &q) { char x; if(!empty_queue(p)) create_empty_queue(p,q); cout<<"Vavedete elementite na queue, end=0:\n";cin>>x; while (x!='0') { put_el(x,p,q); cin>>x; } } void del_el(char *x,queue* &p,queue* &q) { queue *r; r=p; *x=r->inf; if(empty_queue(p)) p=q=NULL; else p=p->next; delete r; } void del_el2(stack *&a, char *x) { stack *q; q=a; *x=a->ini; a=a->nexi; delete q; } void print(queue* &p,queue* &q) { char x; while (!empty_queue(p)) { del_el(&x,p,q); put_el2(x,a); } cout<<x<<" "; } cout<<'\n'; { cout<<endl; } } void print2(stack *&a) { while(!empty_stack(a)) { char x; del_el2(a,&x); cout<<x<<endl; } cout<<endl; } void sort(stack *&,mass t) { int br; for(int i=0;i<br;i++) while(!empty_stack(a)) { char x; del_el2(a,&x); cout<<x<<endl; } cout<<endl; } void main() { mass t; clrscr(); create_queue(p,q); print(p,q); print2(a); cin.get();cin.get(); }
, :
1. , , , . , . .
2. , , .
3. , , .
4.
5. , 2 3
.
Last edited by Bombera; 23rd February 2011 at 13:32.
-
23rd February 2011 11:20 #2UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
geniusloci: ) ; ) ; ) ?
nope|r.i.p.




Reply With Quote
) -,
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in