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 == ....)
{
}
}
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..
elseif opcode And
operand one...
operand two...
elseif Opcode Not
operand one
elseif.....
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.