When lastorder is 'x' then the left side of the condition is true, so the entire condition evaluates to true. Likewise with the right side of the condition. When lastorder is 'X' the right side is true, so the entire condition is true.
You need:
}while ( lastorder != 'X'&& lastorder != 'x');
You might want to review truth tables for logical and/or.
Your condition( lastorder != 'X'|| lastorder != 'x') will result in an infinite loop.
This is because of how if lastorder is 'x' it will see that it doesn't equal 'X' resulting in true, and vice versa if lastorder is 'X'. Remember ||(or) is true so long as one of the conditions is true.
Here are two fixes, change ||(or) to &&(and)( lastorder != 'X' && lastorder != 'x'); or have the comparisons be equal with a not statement e.g, ( !(lastorder == 'X' || lastorder == 'x'));
Although you should use the first one since it's easier to read.
Also PLEASE use code tags next time! It helps everyone read and understand the code that you are posting. To add code tags click the <> tag on the format section to the right.