Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void format_prob(char str_buf[10], double prob)
- {
- if(prob > 0.9995) {
- snprintf(str_buf, 10, "100 %%");
- } else if(prob >= 0.1) {
- snprintf(str_buf, 10, "%4.1f %%", 100.0 * prob);
- } else {
- snprintf(str_buf, 10, " %3.1f %%", 100.0 * prob);
- }
- str_buf[9] = '\0'; //prevents _snprintf error
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement