I keep getting the 'expected unqualified-id before if' error message when trying to run my program
The root of your problem is this line:
if (distance &gt; 10); 

You have an extraneous semi-colon and lack the opening bracket of the block it's intended to start.  It should read:
if (distance &gt; 10) {

Also, later on you have something similar:
if (distance &lt;= 10); {

Here you have remembered the bracket, but have still slipped in the semi-colon that is not wanted.
It is important to remember that every opening bracket must have a matching closing bracket, and every closing bracket must have a corresponding opening one.
If you are strict with yourself and keep your indenting strictly correct you will catch such errors much quicker.
Another trick is to start at the top and count your brackets - add one for every opening bracket and subtract one for every closing bracket. If you ever go negative then you know you have a mismatch. If you go to zero and you're still inside a function then you have a mismatch. You should end up on zero. If you don't then you know you have a mismatch.