# Solved How to inverse percentage?

June 22, 2013 at 17:45:05
Specs: MS-DOS 8+ (WINDOWS XP APLICATION "CMD.EXE" RUNNING TRUGHT "NTVDM.EXE" AS AN APPLICATION INSIDE WINDOWS XP), 4 CORES OF 2.4 GHZ/AND 4GB OF RAM
 HAY MATHEMATICIANS.i am writing my own program.in that program among many other functions, i have two which are important here:first one to copy multiple files from one location to another,and second one to erase original files.both of those functions have progress bar, which displays how moch percent is finished.when copying files, it is easy.two subfunctions count the number of files in new directory, and in original directory.third one function compares those two numbers and returns percentage.and fourth subfunction displays progress bar which is "filled" acording to returned percentage by the third subfunction.the problem is when i use those subfunctions on function for deleting original files.it appears that returned percentage is at the beggining 100%, and at the end 0%, so, my progress bar acctually goes from end to beggining.i know why that is, because there is less and less files in the original directory, so the difference in number of files betwean original directory and the new directory is bigger and bigger.i know that, but because of that my subfunctions returns inverted percentage from wanted.i am planning to add one new subfunction betwean third and fourth one which would invert the percentage.by inverting percentage i mean, when i have 0%, that function return 100%, when for example 49% to return 51% and so on.this is wery easy problem, and i do not want any program code as an answer, just an mathematical formula which invert percentage, and i will turn it in the program code on my own.for now, all i can think of is an manual percentage inverting subfunction, so like, "if /i "%percentage%" equ "100" set percentage=0" and so on untill "if /i "%percentage%" equ "0" set percentage=100", but i do not want to manually do this, because, i do not want to write 100 lines of program code if there is no need. i would prefer just one line of program code in this subfunction in the form of formula. (so like c=a+b or something.)so, what i want you to do, is to tell mi an mathematical formula which will invert percentage.i will start, and you finish it.invertedpercentage=?thank you for your time. :)it is so nice to have a place to write my own problems with computer programs.

See More: How to inverse percentage?

#1
June 22, 2013 at 18:06:16
 Please do not post in all caps. Most members are annoyed by this and many will ignore such posts.

Report •

#2
June 22, 2013 at 18:32:15
 If "x" is your percent you want to invert, you just want "100-x"? Don't know what lang. or script, and no code to look at, so this is about all I can say for now. If the file's sizes vary much, you might want to use diskspace instead of number-of-files for the progress update. Google or search this forum for "progress bar", you will probably find what you want.

Report •

#3
June 23, 2013 at 09:54:00
 I ALLWAYS DO. ;)

Report •

Related Solutions

#4
June 23, 2013 at 09:57:18
 OH, SO IF PERCENTAGE = 100,100-PERCENTAGESO,INVERTEDPERCENTAGE=100-PERCENTAGESO IF I HAVE 22100-22 IS 78YEA, THANK YOU!! ♥WERY MUCH, THIS IS IT.THE CODE ISSET /P INVERTEDPERCENTAGE=100-%PERCENTAGE%IT WORKS, THANK YOU WERY MUCH, "nbrane" ;)

Report •