No , input format is correct in your code .
Not familiar with C++ input fomat… but you should add this… if( z > 180) then z-=180;