Question: Write a program that accepts input from the keyboard (with the input terminated by pressing the Enter key) and counts the number of letters (A-Z
Write a program that accepts input from the keyboard (with the input terminated by pressing the Enter key) and counts the number of letters (A-Z and az), numerical digits (0-9), and other characters. Input the string using cin and use the following looping structure to examine each character in the string with an "if" statement and multiple "else if" statements. char s[50]; int i; . . . i = 0; while (s[i] != 0) { // a string is terminated with a null (0) value . . . i++; } Your program should make use of the relational operators (e.g., == < > <= >= !=) to determine whether a particular character is a letter, number, or other character. You may only #include and may not use any other include files. The program should have an output similar to the following: Enter a continuous string of characters with no blank spaces (example: aBc1234!@#$%) enter your string: aBc1234!@#$% your string has 12 total characters 3 letters 4 numerical characters 5 other characters. C++ format, preferably codeblocks or in notepad
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
