Die Berechnung Der Ganzzahligen Prozentsatz

Also ich möchte berechnen Sie den prozentualen Fortschritt von meinem Programm als den nächsten integer-Wert

In meinen Beispielen lässt

int FilesProcessed = 42;
int TotalFilesToProcess = 153;

Also Zuerst habe ich versucht:

Int TotalProgress = ((FilesProcessed / TotalFilesToProcess) * 100)

Diese zurückgegeben TotalProgress = 0

Dann habe ich versucht

Int TotalProgress = (int)((FilesProcessed / TotalFilesToProcess) * 100)

Diese gibt compiler Fehler sagen Cannot implicitly convert type decimal to int

Ive versucht,

Int TotalProgress = Math.Round((FilesProcessed / TotalFilesToProcess) * 100)

und bekommen The call is ambiguous between decimal and double

so und nun habe ich hier um Hilfe?

Welche Arten sind FilesProcessed und TotalFilesToProcess?
oder multipliziert mit 100, als teilen von TotalFiles

InformationsquelleAutor user1 | 2014-11-12

Schreibe einen Kommentar