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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:30, Cassandoo
The total revenues for a company are $150,223 and the total expenses were 125,766. if you are calculating the net income, which of these spreadsheets would you use? insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2-b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2+b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2/b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2*b3. the formula should be showing in the formula bar.
Answers: 3
image
Computers and Technology, 23.06.2019 16:30, rileysndr1782
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
image
Computers and Technology, 23.06.2019 17:30, Annlee23
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
image
Computers and Technology, 24.06.2019 01:00, kayranicole1
What shows the web address of the page that is currently displayed in the workspace? status window toolbar location bar internet box
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 in other subjects:

Konu
Computers and Technology, 05.07.2019 19:40