create a bool flag before the loop starts and set it to false. when a swap is made change the flag to true. on next loop iteration if the flag is still false then no swaps were performed during the previous loop iteration.
and please next time use code tags.
cutieyan: ammp i have a problem in making c++ programs,,,i am not familiar of it and it is very difficult for me ,our teacher told us to do a c++ program....what am i gonna do????plzzz hlp me