Pure Programmer
Blue Matrix


Cluster Map

Project: Base Conversion

Write a program that converts an integer to any base between 2 and 16. The program should accept two arguments, the maximum number to convert and the base of conversion. The program will then print the numbers 0 to the maximum each converted to the base supplied. The conversion should take place in a separate function that takes the number to convert and the base. Be sure to test the preconditions in the conversion function with assertions.

Output
$ swiftc BaseConversion.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation) $ swiftc BaseConversion.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation) $ swiftc BaseConversion.swift -I . -L . -lUtils error: link command failed with exit code 1 (use -v to see invocation) ld: library not found for -lUtils clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution