Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Delete Three lettered Words in a string help

$
0
0
I'm having trouble grasping what to do next. My program has to take in a string and then delete all the three letter words in the string. I've posted my code below, if someone can point me in the right direction as to how to accomplish this, that would be a big help.
int index,index2;
 string s;
    cin >> s;
 index=s.find(' ');
 index2=s.rfind(' ',index+1);
 int f=(index2-index);
    if(f==4)
    {
     s.erase(index,index2);
    }
cout << s;


Viewing all articles
Browse latest Browse all 51036

Trending Articles