Question: This question will be manually graded; it will show as a 0/16 in your score until it is graded. This question has three parts: A),

 This question will be manually graded; it will show as a

This question will be manually graded; it will show as a 0/16 in your score until it is graded. This question has three parts: A), B), and O. The following code segment reads a string (consists of letters and digits) from the keyboard and counts how many ' O ' 5 are in the string string atr; int zerocount=0: getline (cin,str) ; for(int1=0;1=str.length()1;1++)1if(str[1]=0)zeroCount++; Hint: If you are not familair with length() function, str.length() 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"; str.length() is 7 (Arizona is 7 characters). You need to write 3 different pieces of code. Do not merge all answers into one program. A) Rewrite the above code using a while loop. [5 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. ASCll values for digits are values are between 48-57.' 0 ' is 48 and ' 9 ' is 57 in ASCll values. The 5tring may contain both digits and other characters, so you need to check each character one by one. Example: If the given input string is a 12b34, the total digits is 4. [5 Points] C) Write a C++ code segment that reads integers from the keyboard until user enter 0 and determine the largest. integer entered. There may be any number of inputs before the user enters 0 , including no inputs at all. 0 is countec as part of the input and should be shown as the largest integer if this is the case. [ 6 Points]

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 Databases Questions!