In the function cm() the variable 'cm' is local so it does not exist outside the function. If you want to use the value in another function you must make it global (declared outside any function).
Perhaps you would be better served by returning a value from the cm() function.
duration = pulseIn(pingPin, HIGH);
Then you can use "readDistance1 = cm();", etc.