What's the difference between cout << "\n" and cout << '\n'?
23:41 10 Jan 2026
cout << "Optimal train swapping takes " << cnt << " swaps." << '\n';

Give the wrong answer

UVA 299 WA

Then I try the code that end with "\n", it correct.

cout << "Optimal train swapping takes " << cnt << " swaps." << "\n";

UVA 299 AC


Is there any reason that make the different?

c++ c++11