ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 2649

Hiii Printf Defintions In " % "

by EMILG0NZA - 11-07-2020 - 11:38 PM
#1
Hii so i was coding my float changer  and i just wanna know if some one know a way to have a Exact Float like With no decimals or if it have decimals like just showing the float exact number 

i try with "%g" and i hear something about "%lg" So if u have the answers pleas share to me ;)





Thanks
Disc = 0xemiil
Reply
#2
if you dont want somthing like 0.000 than just do %I and convert your float to int
(11-07-2020 - 11:38 PM)EMILG0NZA Wrote: Hii so i was coding my float changer  and i just wanna know if some one know a way to have a Exact Float like With no decimals or if it have decimals like just showing the float exact number 

i try with "%g" and i hear something about "%lg" So if u have the answers pleas share to me ;)





Thanks
Reply
#3
(11-07-2020 - 11:52 PM)magiccarpet Wrote: if you dont want somthing like 0.000 than just do %I and convert your float to int
Too Many Quotes (Click to View)
Just %i and automaticaly will change to a int?
Disc = 0xemiil
Reply
#4
(11-07-2020 - 11:38 PM)EMILG0NZA Wrote: Hii so i was coding my float changer  and i just wanna know if some one know a way to have a Exact Float like With no decimals or if it have decimals like just showing the float exact number 

i try with "%g" and i hear something about "%lg" So if u have the answers pleas share to me ;)





Thanks
Printf has a option for float to display only part of it. Using %.2f , the number in it represents the amount of numbers displayed after . , here is a little example:

float Myfloat = 3.141592f;
printf(“%.3f”, Myfloat);

Output: 3.141

Serozoid - FREE & FOREVER !
Reply
#5
(11-08-2020 - 12:00 PM)Hynodgy Wrote:
Too Many Quotes (Click to View)
Printf has a option for float to display only part of it. Using %.2f , the number in it represents the amount of numbers displayed after . , here is a little example:

float Myfloat = 3.141592f;
printf(“%.3f”, Myfloat);

Output: 3.141

Serozoid - FREE & FOREVER !
DAMMM bro thanks this its what i was looking for
Disc = 0xemiil
Reply
#6
Use %.0f if you want no precision.
[Image: G05fkTF.jpg]
Reply
#7
(11-08-2020 - 08:33 PM)UNBOUND Wrote: Use %.0f if you want no precision.
Thanks Unbound
Disc = 0xemiil
Reply

Users browsing: 2 Guest(s)