In written text small numbers are often written out, e.g. you'd write 'I have two brothers and one sister', rather than 'I have 2 brothers and 1 sister'. Here we want to implement one (1?) function that helps us realize this. Write a function smallnr() that takes a number x and if x is an integer between 0 and 6 it returns the name of the number, otherwise it simply returns x as a string. >>> smallnr(2)

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 17PE
icon
Related questions
Question

14. In written text small numbers are often written out, e.g. you'd write 'I have two
brothers and one sister', rather than 'I have 2 brothers and 1 sister'. Here we want to
implement one (1?) function that helps us realize this. Write a function smallnr() that
takes a number x and if x is an integer between 0 and 6 it returns the name of the
number, otherwise it simply returns x as a string.
>>> smallnr(2)
'two'
>>> smallnr(0)
'zero'
>>> smallnr(7)
'7'

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning