Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 14:30, Vanesssajohn2962
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
image
Computers and Technology, 23.06.2019 16:00, ginaaa20
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
image
Computers and Technology, 24.06.2019 02:30, sha273
Which option completes the explanation for conflict of interest in an organization
Answers: 1
image
Computers and Technology, 24.06.2019 12:00, elainnysanchez1541
How can we take picture in this app
Answers: 1
Do you know the correct answer?
Write a program that removes all non-alphabetic characters from the given input. Ex: If the input...

Questions in other subjects:

Konu
Mathematics, 07.08.2019 01:30