Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: double variable  (Read 1132 times)

0 Members and 1 Guest are viewing this topic.

MrMou6

  • Newbie
  • *
  • Posts: 17
    • View Profile
double variable
« on: September 14, 2017, 05:22:43 am »
Hello, how I can do that double variable shows only 2 numbers after dot let say:
20.00
not:
20.00000
Quote
double money = 20;
....
         sf::Text walletsk;
         walletsk.setFont(calibri);
         walletsk.setCharacterSize(18);
         walletsk.setFillColor(sf::Color::White);
         walletsk.setPosition(sf::Vector2f(660, 25));
         walletsk.setString(to_string(money));
...
window.draw(walletsk);
But i get result:


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: double variable
« Reply #1 on: September 14, 2017, 07:51:29 am »
Hi

This is a C++ question, it is not related to SFML, and thus you'll get more relevant answers on dedicated forums (stackoverflow, etc.). Here we try to focus on SFML itself.
Laurent Gomila - SFML developer