Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This question will be manually graded; it will show as a 0 / 1 6 in your score until it is graded. This question has
This question will be manually graded; it will show as a in your score until it is graded.
This question has three parts: A B and C
The following code segment reads a string consists of letters and digits from the keyboard and counts how many s are in the string
string str;
int zeroCount;
getlinecinstr;
forint i ; i strlength ; i
ifstri
zeroCount;
Hint: If you are not familair with length function, strlength returns the number of actual characters in a string, and does not count the null character at the end of the string. Ex string str "Arizona"; strlength is Arizona is characters
You need to write different pieces of code. Do not merge all answers into one program.
A Rewrite the above code using a while loop. Points
B Modify the above code code given or your answer to part A above, your choice so that it count how many digits are in the string. ASCII values for digits are values are between is and is in ASCII values. The string may contain both digits and other characters, so you need to check each character one by one.
Example: If the given input string is ab the total digits is Points
C Write a C code segment that reads integers from the keyboard until user enter and determine the largest integer entered. There may be any number of inputs before the user enters including no inputs at all. is counted as part of the input and should be shown as the largest integer if this is the case. Points
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started