Stacks Queues Reverse Reverse Polish

D

dogbite

I need help with an understanding and completing a project in C++ which
involves takingm a string of characters Example /*-A+BCDE as an input and
outputting a postfix expression ABC+-D*E/. I have to use a Stack and a Queue.

I have been given the following main function which I can not change.

#include"a:utility.h"
#incude"a:Stack.h"
#include"a:Queue.h"

// prototypes for input , pretopost, output and is operator go here

main()
{ Queue prefixQ, postfixQ;
char answer;
do
{input (prefixQ);
pretopost (prefixQ, postfixQ);
output(postfiQ);
cout<<endl<<"Continue? N for NO:";
cin<<answer;
} while (!(answer=='n' || answer'N'));
}

and what the heck are .h files am i supposed to write or copy some other
functions on the same target directory ?

Also Please be gentle with me i have limited c++ experience.

Confused biginner??? Thanks
 
R

Ron Natalie

dogbite said:
I have been given the following main function which I can not change.

If you can not change it, you are doomed. The code below isn't valid
C++.
#include"a:utility.h"
#incude"a:Stack.h"
#include"a:Queue.h"
None of these include files are standard.
// prototypes for input , pretopost, output and is operator go here

main()

ERROR. All functions must have a declared return type. Main must have
a return type of int.
and what the heck are .h files am i supposed to write or copy some other
functions on the same target directory ?

I don't know what the heck they are, go gripe at your teacher for a valid file.
 
R

red floyd

Ron said:
If you can not change it, you are doomed. The code below isn't valid
C++.



None of these include files are standard.




ERROR. All functions must have a declared return type. Main must have
a return type of int.



I don't know what the heck they are, go gripe at your teacher for a valid file.

not to mention that he has "cin << answer" instead of "cin >> answer"
 
D

dogbite

Ron Natalie said:
If you can not change it, you are doomed. The code below isn't valid
C++.

None of these include files are standard.
I will change these files to standard files. and i have change the
cin>>answer typeo. Now the question is what should an algorithm for
this problem look like. I am stil having issue understanding queue and
stack operations
ERROR. All functions must have a declared return type. Main must have
a return type of int.

I don't know what the heck they are, go gripe at your teacher for a valid file.

OK i just found out that .h files are copied from a section in the
book and are not included in the .ccp file but in the same directory.
It got this.
 
O

osmium

dogbite said:
I am stil having issue understanding queue and
stack operations

A queue models the action you see in an orderly line waiting for the
services of a single bank teller, sometimes called first in first out or
FIFO. The British meaning of queue if that helps.

A stack models the action you see in the plate dispenser of a cafeteria,
sometimes called last in first out or LIFO.

It may help to write the infix (parenthesized) version of your test equation
and see how the other two versions were arrived at from that. Then, at
least, you would know the right answer if you got it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,369
Latest member
FTMZ

Latest Threads

Top