Someone should please help me solve this... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Someone should please help me solve this...

Write a function named "digit_name" that takes an integer argument in the range from 1 to 9, inclusive,and prints the English name for that integer on the computer screen.if the argument is not in the required range,then the function should print "digit error"

20th Apr 2021, 11:56 PM
GAFAR IBRAHIM OLASUNKANMI
GAFAR IBRAHIM OLASUNKANMI - avatar
2 Answers
+ 1
#include <iostream> // defines cout using namespace std; // so we don't say std:: before cout and endl. void digit_name(int digit) { if (digit == 1) cout << "one"; else if (digit == 2) cout << "two"; // fill this in for 3 - 8. else if (digit == 9) cout << "nine"; else cout << "digit error"; }
21st Apr 2021, 12:05 AM
Josh Greig
Josh Greig - avatar
0
Thanks very sir
21st Apr 2021, 12:45 AM
GAFAR IBRAHIM OLASUNKANMI
GAFAR IBRAHIM OLASUNKANMI - avatar