0
Ich berechne ein Prozent abgeschlossen mit Variablen der gemischten Datentypen.Math mit gemischten variablen Datentypen
int incompleteCritical = 12;
int total = 24;
float progress = 0;
NSLog(@"Incomplete Total: %d", incompleteCritical);
NSLog(@"Total Total: %d", total);
if (total > 0) {
progress = ((float)incompleteCritical/(float)total)*100;
NSLog(@"Progress: %d", progress);
}
Die Konsolenausgabe ist wie folgt:
2011-01-11 10:02:59.993 [18570:207] Incomplete Total: 12
2011-01-11 10:02:59.993 [18570:207] Total Total: 24
2011-01-11 10:02:59.994 [18570:207] Progress: 0
Warum ist Fortschritt nicht "50" Rückkehr?