1

Write it in C++ please Exercise # 1 : The 10 digits are spelled out respectively...

Question

Write it in C++ please Exercise # 1 : The 10 digits are spelled out respectively...

Exercise # 1 : The 10 digits are spelled out respectively as follows: Zero, One, Two, Three, Four, Five, Six, Seven, Eight, and Nine. Write a program that prompts the user to enter a one digit positive integer and prints the number of characters required to spell out the integer. For example, if the integer is 7 then it is spelled Seven which requires 5 characters. Sample input/ output: Enter a one digit number: 8 8 has 5 characters.
write it in C++ please
Exercise # 1 : The 10 digits are spelled out respectively as follows: "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", and "Nine". Write a program that prompts the user to enter a one digit positive integer and prints the number of characters required to spell out the integer. For example, if the integer is 7 then it is spelled "Seven" which requires 5 characters. Sample input/ output: Enter a one digit number: 8 8 has 5 characters.

Answers

#include<iostream>

#include<cstring>

using namespace std;

int main()

{

string spell[10]={"Zero","one","two","three","four","five","six","seven","eight","nine"};

int digit;

cout<<"Enter a onr digit number: ";

cin>>digit;

if(digit>=0 && digit<=9) //check entered digit is one digit or not

{

cout<<digit<<" has "<<spell[digit].length()<<" characters."; //output length

}

else

cout<<"Wrong Input......."

}

output:


Similar Solved Questions

1 answers
Scenario: Aviation Inc. purchased securities on 1/1/2019 that would initially be accounted for in the financial...
Scenario: Aviation Inc. purchased securities on 1/1/2019 that would initially be accounted for in the financial statements as an investment held-to-maturity. Held to Maturity Securities: Cost 1/1/2019 Fair Market Value 12/31/2019 Bronx Co. Bonds $ 300,000 $ 278,000 ...
1 answers
Violet's tax liability was $5,000 and withheld tax and estimated tax payments were $4,500. He had...
Violet's tax liability was $5,000 and withheld tax and estimated tax payments were $4,500. He had not applied for extension and filed his tax return 8 months after the due date. Which of the following statements is correct regarding penalty for failure to file a tax return? No penalty is applica...
1 answers
LO 2.3Markson and Sons leases a copy machine with terms that include a fixed fee each...
LO 2.3Markson and Sons leases a copy machine with terms that include a fixed fee each month of $500 plus a charge for each copy made. The company uses the high-low method to analyze costs. If Markson paid $360 for 5.000 copies and $280 for 3,000 copies how much would Markson pay if it made 7.500 cop...
1 answers
QUESTION 1: a, What are the nursing education for the teaching of drug Rifampicin? b. What...
QUESTION 1: a, What are the nursing education for the teaching of drug Rifampicin? b. What are the nursing education for the teaching of Isoniazid? Please cite your source; thanks....
1 answers
1. ZYX Ltd. has sales of $1,000,000, retention ratio of 65%, equity multiplier of 2.5, dividends...
1. ZYX Ltd. has sales of $1,000,000, retention ratio of 65%, equity multiplier of 2.5, dividends of $30,000, and equity of $312,500. What is the growth rate that the firm can achieve without outside financing? Select one: a. 6.11% b. 6.76% c. 7.13% d. 7.68% e. There is insufficient information given...
1 answers
Ces Mailings Review View Help Search Aa A a E3 21 AaBBCCDC) AaBbCcDc AaBbc A Normal...
ces Mailings Review View Help Search Aa A a E3 21 AaBBCCDC) AaBbCcDc AaBbc A Normal 1 No Spac. Heading 1 H Paragraph Styles 1: Who can specimen labeling error impact nursing practice setting. And how can it impact by research evidence 2Why is this issue important? Why does it matter? Who/what is neg...
1 answers
***** PSEUDOCODE PLEASE****** ***** PSUDOCODE PLEASE****** Program 0 (Warm-up): Deoxyribonucleic acid, or DNA, is comprised of...
***** PSEUDOCODE PLEASE****** ***** PSUDOCODE PLEASE****** Program 0 (Warm-up): Deoxyribonucleic acid, or DNA, is comprised of four bases: (G)uanine, (C)ytosine, (A)denine and (T)hymine.  Ribonucleic acid, or RNA, is different than DNA in that it contains no Thymine; thymine is replaced wi...
1 answers
11.   A) Name the membrane-bound enzyme that directly links the TCA cycle with the electron transport...
11.   A) Name the membrane-bound enzyme that directly links the TCA cycle with the electron transport chain. Give its name in the TCA cycle and the electron transport chain. B) Name at least two other starting points for substrates used in the electron transport chain. C) Approximately how...
1 answers
Calculate the maximum wavelength of electromagnetic radiation that can eject electrons from the surface of metallic...
Calculate the maximum wavelength of electromagnetic radiation that can eject electrons from the surface of metallic tungsten, which has a work function of 7.29x10-19 J. If the maximum velocity of the emitted photoelectrons are required to be 2.00x106 m/s, calculate the wavelength of the incident rad...
1 answers
Please edit my following JAVA code so that there is no main function. I would like...
Please edit my following JAVA code so that there is no main function. I would like one function in this class that completes what the current program is trying to do so that I can call this class in my main class which will be separate. import java.math.RoundingMode; import java.text.DecimalFormat; ...
1 answers
Winter 2019 8) Calculate the standard error of the mean and 90% con estimated sample means...
Winter 2019 8) Calculate the standard error of the mean and 90% con estimated sample means from the Three Small Villages datase Standardt-Value Sample Mean Confidence Interval (1 decimal) | for P = 0.10 Error of (1 decimal) the Mean Two-Tailed Village (1 decimal) (3 decimals) Smallville .1 29-1 Mayb...
1 answers
What is the description for the parallax technique for measuring the distance to the stars?
What is the description for the parallax technique for measuring the distance to the stars?...
1 answers
Order: Deltasone 7.5 mg Available: Deltasone 2.5 mg/tablet a. 3 1/2 tablets b. 2 tablets c....
Order: Deltasone 7.5 mg Available: Deltasone 2.5 mg/tablet a. 3 1/2 tablets b. 2 tablets c. 2 1/2 tablets d. 3 tablets...
1 answers
Suppose 6 numbers are generated by a computer, each uniform on the interval (0, 1). Let...
Suppose 6 numbers are generated by a computer, each uniform on the interval (0, 1). Let Y be the random variable representing the smallest of the numbers. (a) Show that the probability density of Y is given by py (t) -61-t)5, 0t <1 [51 Hint: The probability density for the r-th largest random var...
1 answers
Question a and b A patient admitted following an accident involving massive crush injuries has the...
question a and b A patient admitted following an accident involving massive crush injuries has the following urinalysis results: color: red brown clarity: clear Specific gravity: 1.011 pH: 6.0 protein: 1+ blood: large glucose: negative ketones: negative nitrite: negative leukocytes: negative bili...
1 answers
Please answer the questions in detail with all working and maths Suppose that T is a...
Please answer the questions in detail with all working and maths Suppose that T is a tree such that for every vertex v of T. (deg())%3 = 1. Prove that I cannot have 25 vertices....
1 answers
An embankment is to be constructed using a sandy soil from a borrow pit. In a standard compaction test on a soil (grain specific gravity of 2.7) the following results were obtained: Water content...
An embankment is to be constructed using a sandy soil from a borrow pit. In a standard compaction test on a soil (grain specific gravity of 2.7) the following results were obtained: Water content (%) Y  kN/m3 6.2 16.9 8.1 18.7 9.8 19.5 11.5 20.5 12.3 20....
3 answers
1. A structural I beam is made of iron. A view of its cross-section and its...
1. A structural I beam is made of iron. A view of its cross-section and its dimensions is shown in the figure, where d = 2 cm, w = 29 cm, h = 30 cm and the length (not shown) of the beam is l = 1.29 m. The density of iron is 7560 kg/m3 . The atomic weight of iron is 55.85 g/mol and Avo- gadro number...
1 answers
Exercise 1.10 For f(c) continuous in a neighborhood of 2o, consider li 1+20 f(x) - f(2.10...
Exercise 1.10 For f(c) continuous in a neighborhood of 2o, consider li 1+20 f(x) - f(2.10 - 2) 21-30) (1.11) (a) Prove or give a counterexample: When f'(o) exists, limit (1.11) also exists and it is equal to f'(to). (b) Prove or give a counterexample: When limit (1.11) exists, it equals f...
1 answers
Correlation coefficient quantifies linear relationship with a number between
correlation coefficient quantifies linear relationship with a number between...

-- 0.056390--