I have the following code:
Code:
.......
typedef unsigned long long CONTADOR;
.......
for ( i = 0; i < g_i_hwm ; ++i ) {
l_prof_time += g_tag[i].l_total;
l_time_tipos[g_tag[i].tipo] += g_tag[i].l_total;
}
.....
for (int m = 0; m < 4; m++) {
switch (m) {
case P_A:
fprintf ( salida , "A: % 12u (%4.1f%%)\n",l_time_tipos[m],(double) (l_time_tipos[m]*100/l_prof_time));
break;
case P_B:
fprintf ( salida , "B: % 12u (%4.1f%%)\n",l_time_tipos[m],(double)(l_time_tipos[m]*100/l_prof_time));
break;
case P_C:
fprintf ( salida , "C: % 12u (%4.1f%%)\n",l_time_tipos[m],(double)(l_time_tipos[m]*100/l_prof_time));
break;
case P_D:
fprintf ( salida , "D: % 12u (%4.1f%%)\n",l_time_tipos[m],(double) (l_time_tipos[m]*100/l_prof_time));
break;
default:
break;
}
}
fprintf ( salida , "Total: %12u\n", l_prof_time);
And I get the following output:
Code:
A: 31011584 ( 0.0%)
B: 38044808 ( 0.0%)
C: 155035960 ( 0.0%)
D: 337083256 ( 0.0%)
Total: 561175608
My code is not showing the percent. I have trying replacing "double" with "float" without success.
How can I print % for unsigned long long?
thanks in advance