(Solved) : Introduction Several Seasons Hot Summers Cold Winters Taken Toll Farmer John S Fence Decid Q18916914 . . .

INTRODUCTION: Several seasons of hot summersand cold winters have taken their toll on Farmer John’s fence, andhe decides it is time to repaint it, along with the help of hisfavorite cow, Bessie. Unfortunately, while Bessie is remarkablyproficient at painting, she is not as good at understanding FarmerJohn’s instructions.

If we regard the fence as a one-dimensional number line, FarmerJohn paints the interval between x=a and x=b. For example, if a=3and b=5, then Farmer John paints an interval of length 2. Bessie,misunderstanding Farmer John’s instructions, paints the intervalfrom x=c to x=d, which may possibly overlap with none, part, or allof Farmer John’s interval. Please determine the total length offence that is now covered with paint.


Your program must open and read an input file containingthe following two lines of data:

The first line of the input file contains the integers a and b,separated by a space (a

The second line of the input file contains integers c and d,separated by a space (c

The values of a, b, c, and d all lie in the range 0…100,inclusive.


Please output a single line containing the total length of thefence covered with paint.


7 10

4 8



Here, 6 total units of fence are covered with paint, from x=4all the way through x=10.


At the top of each of your C++programs, you should have at least four lines of documentation:

// Program name: tictactoe.cpp

// Author: Twilight Sparkle

// Date last updated: 5/26/2016

// Purpose: Play the game ofTic-Tac-Toe

               1.The Source code for the lab assignment(*.cpp)

               2.And any Header files for the lab assignment (*.h)


Expert Answer

. . .