first, there isn't a standard way of doing this, there is no C++ temperature class, or function that just pulls the info from nowhere.
second, of the available methods they are of course different in Windows and Linux.
Third, it, the data is provided as a function of the hardware available and the bios. if there is no temperature probe, or the temperature info isn't ever interpreted by the machine, (like it's just a simple switch) then you'll have no data to collect.
fourth, even if the data is available, it doesn't have to be presented in a standard way, and different hardware manufacturers may present data in different ways...
if you're using linux then you can grep /proc/acpi/thermal_zone/THRM/temperature for the information., and write a program to open that file and read the relevant bytes.
if you're using windows then use the WMI class Win32_TemperatureProbe
https://msdn.microsoft.com/en-us/library/aa394493(VS.85).aspx
if that doesn't work you may try
using WMI and query MSAcpi_ThermalZoneTemperature looking for the value of "CurrentTemperature"