W2031 Designing a Floating Point Type

From Coder Merlin
Jump to navigation Jump to search
Evergreen Point Floating Bridge

Prerequisites[edit]

Background[edit]

Introduction[edit]

Topic Headers[edit]

Key Concepts[edit]

Exercises[edit]

ExercisesIcon.png
Exercises
  • Design a struct named Real whose member properties may only be of type Int or Bool.
  • Define initializers:
    • init(_ d:Double)
    • init(_ n:Int)
  • Define functions for addition, subtraction, multiplication, and division.
    • All such functions should take the form: func operationName(_ other:Real) -> Real
    • These functions should be named add, subtract, multiply, and divide

References[edit]


CoderMerlin™ proudly recommends:
HintIcon.png

Your purchase via these links helps keep  Coder Merlin™ 's orbuculum ablaze. As an Amazon Associate we earn from qualifying purchases. Thank you for your support!


Designed with pride in Silicon Valley, CA, USA