title: removing trailing zeroes for a float value c++
body: <p>I am trying to set up a nodemcu module to collect data from a temperature sensor, and send it using mqtt pubsubclient to my mqtt broker, but that is not the problem.</p>
  
  <p>I am trying to send the temperature in a format that only has one decimal, and at this point I've succesfully made it round up or down, but the format is not right. as of now it rounds the temp to 24.50, 27.80, 23.10 etc. I want to remove the trailing zereos, so it becomes 24.5, 27.8, 23.1 etc.</p>
  
  <p>I have this code set up so far:</p>
  
  <pre><code>#include &lt;math.h&gt;
  #include &lt;PubSubClient.h&gt;
  #include &lt;ESP8266WiFi.h&gt;
  
  
  float temp = 0;
  
  void loop {
    float newTemp = sensors.getTempCByIndex(0);
  
    temp = roundf((newTemp * 10)) / 10;
    serial.println(String(temp).c_str())
    client.publish("/test/temperature", String(temp).c_str(), true);
  
  }
  </code></pre>
  
  <p>I'm fairly new to c++, so any help would be appreciated.</p>