subject

Write a program that removes all non-alphabetic characters from the given input. Ex: If the input is:

-Hello, 1 world$!
the output is:

Helloworld

Your program must define and call the following function. The function should return a string representing the input string without non-alphabetic characters.

string RemoveNonAlpha(string userString)

#include
#include
#include
using namespace std;

/* Define your function here */
string RemoveNonAlpha(string userString)
{
char ch;
string str;
int length;
length = userString. length();
for (int i = 0; i <= length; i++)
{
ch = userString;
if (isalpha(ch))
{
str += ch;
}
}
return str;
}

int main()
{
// Local Variables
string input;

getline(cin, input);

cout << RemoveNonAlpha(input) << endl;

return 0;
}

my code is wrong but I can't seem to figure out the problem becuase i am getting no output

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:10
(328 inc. 448 ind. 480 in25. john has a collection of toy cars. he has 2 red cars, 4 blue cars, 4 black cars, and 6 yellowcars. what is the ratio of red cars to yellow cars? a. 1: 2b. 1: 3c. 1: 626. the net of a right triangular prism is shown below.
Answers: 2
question
Computers and Technology, 23.06.2019 20:00
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
question
Computers and Technology, 24.06.2019 18:50
Which style did jack use on the vocabulary words in reports?
Answers: 2
question
Computers and Technology, 24.06.2019 23:30
Which example can be considered master data in an organization? a. holiday list b. dress code c. employee information d. recreational activities
Answers: 1
You know the right answer?
Write a program that removes all non-alphabetic characters from the given input. Ex: If the input...
Questions
question
Health, 11.01.2021 05:40
question
History, 11.01.2021 05:40
question
Mathematics, 11.01.2021 05:40
question
Mathematics, 11.01.2021 05:40
question
Mathematics, 11.01.2021 05:40
question
Geography, 11.01.2021 05:40
Questions on the website: 13722363