00:01
Hello students, as here is the explanation of the code over here which is written in a c+ + program that calculates the distance of watermelon falls given the number of the seconds and the height of the bridge.
00:15
So it also checks if the total distance fallen is greater than the height of the bridge and informs the users if it's not the valid scenario.
00:23
So as of here you can see it defines the constant g representing the acceleration due to the gravity that is 9 .8 and initializes the variables t as well as h to store the input for the time and the height.
00:46
Then the program prompts the users to enter the number of the seconds that is the t and also the program prompts the users to enter the number to enter the waterfall and the height of the bridge above the water that is the height in a meter.
01:03
So then it checks if the entered values are non -negative.
01:08
So if it is a non -negative, if either value is negative then it displays an error and exits from it.
01:16
If both the values are non -negative then the program calculates the distance fallen as the distance fallen is equal to using the formula 0 .5 into the gravity of into the power of t by t is to 2.
01:35
So weight g is the acceleration due to gravity and t is the time in a second...