it's also suppose to be able to clear all data if you enter "C" and ask for a new first number
Easiest thing would be to store the last result in a variable and use a boolean to tell whether you should use the last result or ask for a new first number. If true set a to the variable storing the last result otherwise ask for a number.
My other problems are the calculator breaking when I enter random numbers into the operator
That's a bit vague. What numbers and how exactly does it break? Does the program crash or does it return incorrect results?
I also can't figure out a loop to return to asking for a new operator if this happens (or if you divide by zero)