+ 1

In a string of Alphabets and numbers that a user will input how can we remove the numbers and display output of alphabet only?

C++ solution needed

20th Oct 2020, 12:47 PM
Akshat
Akshat - avatar
2 Antworten
+ 5
big alphabet characters have integer values from 65 to 90. small alphabet characters have integer values from 97 to 122. When you want to check, whether a character is an alphabet, you need to handle the character as an integer and check, whether the integer is in either of these previous ranges: c >= 65 && c <= 90 || c >= 97 && c <= 122 You can iterate through a string with a char variable and only print the characters, for which the previous condition is true. (string represents the user input)
20th Oct 2020, 12:54 PM
Seb TheS
Seb TheS - avatar