This is topic Yes yes! Highest grade on a test in over THREE YEARS!!!! programmers invited in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=045433

Posted by Blayne Bradley (Member # 8565) on :
 
99%!!! I can't even remember the last time I got a mark so high! its worth 40% of my grade!

Also anothe rmoral boost I had was that I have to write a program that converts infix to postfix, the second version I had to make is supposed to be full of stubs but the output its supposed to look like this:
eg:
INFIX POSTFIX VALUE
. . 13.675
. . .
A+B*C AB+C* .
. . .


Basically I'm given a prechosen list of Infix strings in an array which I made a global and I supposed to out put them in a for loop and basically a final value of a random number of some kind (remeber evaluating the postfix expressions is just a stub function so it will for the time being return a float).

There's a loop that looks like this:

printf "%-30s etc etc etc\n", "INFIX, POSTFIX, VALUE"

for int j = 0; j < LSIZE, j++
{ //ifx is infix holding buffer
. strcpy{ ifx, infix{j}}; //infix is string array of infix expressions
. infixindex = j; //making the index
. convert{ ifx, pfx } //converts infix to postfix
. pfval = Eval{pfx};
}


now the conversion function is a stub inside it are postfixes already in a postfix array and will each time the loop runs spits out each postfix one at a time.

Here was my problem, the postfix array was inside a function, and was only sending it out one at a time. The output loop would only fire after the loop mentioned above finished going through each infix and postfix string.

So how do I store all of them?

Eventually all on my own I initialized an empty array for postfix and has it so that each time a postfix was spat out it was string copied into the new postfix array.


As such I added strcpy{ postfix{j}, pfx } to after the conversion function was called to handle the job.

Problem still remaining: Aside from now needing to get a fully working pop/push stack algorthm going...


cout << setw{-24} << infix{j} << setw{25} << postfix{j} << setw{30} << pfval << endl;

It aligns the INfex and postfix strings perfectly but the Pfval string isnt they are push the setw distance away from the postfix strings X amount x being the size of the postfix string for some reason.
 
Posted by Blayne Bradley (Member # 8565) on :
 
Just me or is this forum really not programmer friendly with this no paranthesis inside html tag thingy
 
Posted by twinky (Member # 693) on :
 
You can use code tags, which gives you a fixed-width font. It's just like bold or italic tags, only the result looks like
code:
this

[Smile]
 
Posted by erosomniac (Member # 6834) on :
 
Congratulations, Blayne! ^_^
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2