I wrote this programm, and the "if (check==height)" in the "while" sequence doesn't work (it's never true). The problem might be that "hight" and "check" are "float". I did check exactly the same programm for "int", and in works just fine.
Seems you are comparing floats for (in)equality. Never, ever do this. Floats are by nature not precisely represented. Use integers instead, or compare using epsilon.
I was required to use floats and didn't know that I can't compare them, used "if (fabs(check-hight) < 0.001)" and it worked just fine, thank you so much.