-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostfix.cpp
More file actions
94 lines (79 loc) · 1.15 KB
/
Copy pathpostfix.cpp
File metadata and controls
94 lines (79 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
typedef struct myQueue
{
char item;
myQueue *next;
}mq;
//add
void enque(char item, mq *&front, mq *&rear)
{
mq *newQ = new mq;
newQ->item=item;
newQ->next =NULL;
if(rear)
{
rear->next=newQ;
rear=newQ;
}
else front=rear=newQ;
}
//remove
char dequeue(mq *&front, mq *& rear)
{
mq *temp;
if(front)
{
temp = front;
front = front->next;
delete temp;
}
if(!front)
{
rear=NULL;
}
return item;
}
void process(mq *&front, mq *&rear)
{
char data;
data=dequeue(front,rear);
if(data!=')'); /*in the last program
he used this except data > 0, so i'm assuming
i have to adapt it for the postfix order*/
enque(data,front,rear);
}
const char * toHex(string postfix)
{
}
int main()
{
FILE *in1, *out;
in1=fopen("input.txt", "r");
char data;
mq *front1;
mq *rear1;
mq *end;
front=rear=NULL;
while(in.good())
{
in>> data;
enque(data,front,rear);
}
//traverse(front);
end=rear;
if(front)
{
while(front!=end)
process(front,rear);
process(front,rear);
}
//xtraverse(front);
cin >> data;
}
void algorithimlol()
{
}