CodeTheRobot

C++ Beginner · exercise 02

Types, values, conversions

Convert degrees to radians and show what an explicit narrowing cast does.

C++ Beginner lesson 02

Guided steps

  1. 1.Store 90 degrees in a const double and convert it to radians.
  2. 2.Print the radian value with four decimal places using std::fixed and std::setprecision.
  3. 3.Cast radians * 1000 to int and print it: the fraction is discarded, not rounded.

Your code

Your code is saved in this browser after every run and restored next time.