program - File is not being read correctly

what the
Last edited on
use code and /code tags in [] respectively to get your code to come out nicely.

I don't see a loop to read the file anywhere. You have a conditional for the operation reads of multiple parts but I don't see a while(!myfile.eof()) do stuff any where in your program.

For Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14

myfile.open("mytext.txt");
// check to see if opened....
while(!myfile.eof())
{
        // get first op code
        cin >> OpCode;
        if(OpCode == ....)
        {
        }
        else (OpCode == ....)
        {
        }
}
Last edited on
what the
Last edited on
after re-analyzing your code it is is the Operand2 function with the ignore lines. It is screwing up your file pointers and positions should be.

I am back at my original thoughts on the algorithm for this program.

1
2
3
4
5
6
7
8
9
10
11
12
13
Loop to eof...
     read op code.
     if opcode convert
        operand one..
     else if opcode And
        operand one...
        operand two...
     else if Opcode Not
        operand one
     else if.....

     DoMath();
end of loop.


I don't need to care about the number lines I have. This thought process would keep my file pointers where I Expect them to be. Your code screws the file position up, which in turns makes your code look like its running once.

this program is being too complex for the problem presented.
Last edited on
erasing your post after you get an answer = lame.

*makes mental note to self never to help l2p with any future problem*
I agree Disch.

If you are asking for help on a homework problem which I gave no answers to just suggestions on how to attack.
Topic archived. No new replies allowed.