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 17:30
What are the most commonly found items in the trash according to the municipal solid waste report?
Answers: 1
question
Computers and Technology, 24.06.2019 00:40
Use a software program or a graphing utility with matrix capabilities to solve the system of linear equations using an inverse matrix. x1 + 2x2 βˆ’ x3 + 3x4 βˆ’ x5 = 6 x1 βˆ’ 3x2 + x3 + 2x4 βˆ’ x5 = βˆ’6 2x1 + x2 + x3 βˆ’ 3x4 + x5 = 3 x1 βˆ’ x2 + 2x3 + x4 βˆ’ x5 = βˆ’3 2x1 + x2 βˆ’ x3 + 2x4 + x5 = 5
Answers: 3
question
Computers and Technology, 25.06.2019 09:00
(environmental science semester 1) which statement best describes the limits of science? a. science cannot answer any abstract questions. b. when used properly, science can answer any questions. c. usually science can answer only mathematical questions. d. science cannot answer religious questions.
Answers: 2
question
Computers and Technology, 25.06.2019 11:30
If you have a document that is relevant to more than one folder on your computer, what should you do? a. save the document to the most appropriate folder.b. save the document in each folder.c. save the document in my documents rather than in one of the folders.d. save the document to libraries.
Answers: 2
You know the right answer?
Write a program that removes all non-alphabetic characters from the given input. Ex: If the input...
Questions
question
English, 22.01.2020 14:31
question
Physics, 22.01.2020 14:31
question
Social Studies, 22.01.2020 14:31
question
History, 22.01.2020 14:31
Questions on the website: 13722363