I have a short C++ program to calculate the wind-chill index given a temperature and wind speed. It's working fine on a Windows 10 machine and outputing exactly as it should. To print the degrees symbol ° I'm using static_cast<unsigned char>(248)
.
However, I'm getting different results on a MAC. I assume this is because of the different character set encoding between each of the two machines. How can I get around this problem, to ensure the degrees-symbol ° will print on both?
Here is the line of code and screen print of the output
cout << "When temperature is " << temp << " degrees and wind speed is " << windSpeed
<< " m/s, then the wind chill is " << tempEff << static_cast<unsigned char>(248) <<"C\n\n";
However, the same code returns a "\370" on a Macbook/MAC OS, which is incorrect. See output here: