Jump to content

Lógica e algoritmo:


lidi_si
 Share

Recommended Posts

Para obteres a parte inteira de um real podes fazer casting para o tipo inteiro. Para obter a parte fraccionária basta calcular a diferença entre o valor original e o valor obtido do casting . Para o arredondamento tens de usar a função floor: http://www.cplusplus.com/reference/clibrary/cmath/floor/

Fazes floor(x+0.5).

Não te esqueças de linkar a biblioteca math através da flag: -lm

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.