Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Stacks Queues Reverse Reverse Polish

Reply
Thread Tools

Stacks Queues Reverse Reverse Polish

 
 
dogbite
Guest
Posts: n/a
 
      10-09-2003
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
 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      10-09-2003

"dogbite" <> wrote in message news: om...

> 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.


 
Reply With Quote
 
 
 
 
red floyd
Guest
Posts: n/a
 
      10-09-2003
Ron Natalie wrote:
> "dogbite" <> wrote in message news: om...
>
>
>>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.
>
>


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

 
Reply With Quote
 
dogbite
Guest
Posts: n/a
 
      10-10-2003
"Ron Natalie" <> wrote in message news:<3f85b20c$0$160$ >...
> "dogbite" <> wrote in message news: om...
>
> > 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.
>

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

> >
> > // 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.


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.
 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      10-10-2003
dogbite writes:

> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reverse Polish Ruby jjthrash@gmail.com Ruby 0 10-20-2006 02:06 PM
Reverse Polish Notation calculator matrix584@gmail.com Java 2 02-06-2006 09:21 PM
Reverse polish Steve Lambert C Programming 11 12-30-2004 04:00 AM
Applications of stacks/queues/trees/heap/BST Ice C++ 4 12-19-2004 06:04 PM
Help I'm stuck on a reverse polish calculation ron Java 1 07-02-2003 04:43 PM



Advertisments
 



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