I am having issues with a programming project.
I haven't coded in about a year but I have quite a bit of code and need help just putting it all together.
The objectives of this program are to take a line of text from the user and put it in a string.
The string is then passed through two filters. The first removes all words that are three letters.
The second removes all words that have a the letter q in them and replace the whole word with the letter x
Any help would be very much appreciated.
I haven't coded in about a year but I have quite a bit of code and need help just putting it all together.
The objectives of this program are to take a line of text from the user and put it in a string.
The string is then passed through two filters. The first removes all words that are three letters.
The second removes all words that have a the letter q in them and replace the whole word with the letter x
Any help would be very much appreciated.
#include <iostream> #include <cstdlib> #include <string> using namespace std; void threeletter(string s); void qkiller(); int main() { string s; cout << "Enter a line of text followed by the enter key" << endl; getline(cin, s); threeletter(s); } void threeletter(string s,) { int index, index2; index=s.find(' '); index2=s.rfind(' ', index-1); if ((index==string::npos)&&(index2==string::npos)) s=" "; if (index==string::npos) if (index2==string::npos) if (index2-index== 4) s.erase(index, 4); } void qkiller() { string s; int first,last,number ,place; place=s.find('q'); first=s.rfind(' ', place-1); last=s.find(' ', place+1); if ((first==string::npos)&&(last==string::npos)) s="x"; if (first==string::npos) if (last==string::npos) number=last-first; }