it solved, thanks!!
Last edited on
Firstly, edit your post so it uses code tags - the <> button on the right.
Your program has a logical error - the order you do things is not quite right.
Imagine that you are a debugging program - go through the code line by line and write down the values of each variable.
You can do the same thing by putting lots of cout statements through out your code.
Even better - learn how to use the debugger.
Hope all goes well.