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, 22.06.2019 15:30
Whats are the different parts of no verbal comunication, especially body language?
Answers: 3
question
Computers and Technology, 23.06.2019 03:50
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
question
Computers and Technology, 24.06.2019 02:50
Be sure to answer all parts. synthesize the following compound from benzene. a. b. c. d. e. f. reaction [1] conditions: a b c d e f reaction [1] product: draw structure reaction [2] conditions: a b c d e f reaction [2] product: draw structure reaction [3] conditions: a b c d e f reaction [3] product:
Answers: 3
question
Computers and Technology, 24.06.2019 19:20
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
You know the right answer?
Write a program that removes all non-alphabetic characters from the given input. Ex: If the input...
Questions
Questions on the website: 13722362