Question: Instructor note: Hint: Check out Figure 4.6.1: Iterating through a string: Counting letters, and review how to use the isdigit() function. LAB ACTIVITY 4.18.1: LAB:

Instructor note:

Hint: Check out Figure 4.6.1: "Iterating through a string: Counting letters", and review how to use the isdigit() function.

LAB ACTIVITY

4.18.1: LAB: Checker for integer string

open_in_newfullscreen0 / 10

Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs Yes if every character is a digit 0-9.

Ex: If the input is:

1995

the output is:

Yes

Ex: If the input is:

42,000

or

1995!

the output is:

No

Hint: Use a loop and the isdigit() function (don't forget to include the cctype library).


Instructor note: Hint: Check out Figure 4.6.1: "Iterating through a string: Countingletters", and review how to use the isdigit() function. LAB ACTIVITY 4.18.1: 

Instructor note: Hint: Check out Figure 4.6.1: "Iterating through a string: Counting letters", and review how to use the isdigit() function. LAB ACTIVITY 4.18.1: LAB: Checker for integer string 0/ Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs Yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: Yes Ex: If the input is: 42,000 or 1995! the output is: No Hint: Use a loop and the isdigit() function (don't forget to include the cctype library).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!