I am new in stackoverflow and i am sorry if i make mistakes.
I am starter in C language and i have one project what it needs to subtact a weight per second.For example Weight: 50kg Subtract per second 4%
i found this code
while(waitFor(1))
{
*weight=(*weight)-(*weight)*0.4;
}
void waitFor(int secs)
{
int retTime;
retTime = time(0) + secs; // Get finishing time.
while (time(0) < retTime); // Loop until it arrives.
}
But i dont want to wait x seconds to finish. I want faster solution. Any ideas
**Note: I want to know how much seconds need to make weight 0 Sleep command it is not working in my computer. **
For cleaning and disinfecting of the pool dropped into the water of a chemical a solid body. This solid body upon contact with water immediately begins to dissolve, losing weight equal to 4% by mass per second. If the dissolution rate of the chemical remains constant, to implement program will accept the weight of the solid body in grams and displays after how time will completely dissolve. The time is displayed in a "hours: minutes: seconds". For example, if the dissolution time is 3,740 seconds, displaying 01: 02: 20. To calculate the time you need to implement a function which accepts gram and return the three time parameters ie hours, minutes and seconds. Note that the time printed on the main function.