Let x be the width of the rectangle. Then x+2 is the length of the rectangle.
Given diagonal is of 10 cm.
By Pythagorean theorem,

Factorize the quadratic equation.

implies x = -8 and x = 6.
Since dimension can't be negative, the value of x is 6.
Thus, the length of the rectangle is 8 and width of the rectangle is 6.