[Solved] C++, for, Infinite loop
The main problem is, you are changing the value of s in inner loop but when the inner loop terminates, you don’t reset s to 0. Hence s == p never become true. Try this: for (g = 0; a == 0; g++) { for (c = 0; p > s; c++) { s = … Read more