Answer:
....................................
Explanation:
Answer:
The function code and the formula for the above question is listed below:
Explanation:
Function:
float typing_speed(int Number_of_words, int Time_in_seconds)
{
float time= Time_in_seconds/60;
float speed= Number_of_words/time;
return speed;
}
Formula for this algorithm or program:
Number of words per minute= number of words/ Time(in minutes).
Function Explanation
- The above function defined in the c-language code, which is used to return the typing speed for any user when he enters the number of words and the time in seconds.
- The speed is calculated with the help of the above-defined formula.
- The first statement of the code is used to change the time in a minute.
- The second statement of the code is used to calculate the speed by the help of speed formula.
- Then the third statement returns the value of the speed variable.
Answer:
Here is a UpdateTimeWindow() method with parameters timeStart, timeEnd, and offsetAmount
// the timeEnd and timeStart variables are passed by pointer
void UpdateTimeWindow(int* timeStart, int* timeEnd, int offsetAmount){
// this can also be written as *timeStart = *timeStart + offsetAmount;
*timeStart += offsetAmount; //adds value of offsetAmount to that of //timeStart
// this can also be written as *timeEnd = *timeEnd + offsetAmount;
*timeEnd += offsetAmount; } //adds value of offsetAmount to that of //timeEnd
Explanation:
The function has three int parameters timeStart, timeEnd, and offsetAmount.
First two parameters timeStart and End are passed by pointer. You can see the asterisk sign with them. Then in the body of the function there are two statements *timeStart += offsetAmount; and *End+= offsetAmount; in these statements the offsetAmount is added to the each of the two parameters timeStart and timeEnd.