main.cpp:17:16: warning: format '%f' expects argument of type 'double', but argument 2 has type 'int (*)()' [-Wformat=]
printf("This is the random number: %f\n",rand);
main.cpp:13:11: warning: unused variable 'r' [-Wunused-variable]
float r = static_cast <float> (rand() / static_cast <float> (RAND_MAX));
rand is a function, but you're passing it as a pointer instead of calling it.
r is the random number that you calculate once on line 13 and never use.
It only runs it once!
It's an infinite loop for me. scanf waits for user input. And look up what the return value of scanf means, because it doesn't mean what you think it means.