Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: C++  |  size: 0.37 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. #include<iostream>
  3. #include<string>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8. string s1,s2;
  9. cout<<"inserisci prima stringa\n";
  10. getline(cin,s1);
  11. cout<<"inserisci seconda stringa\n";
  12. getline (cin,s2);
  13. int n=s1.find(s2);
  14. if (n>=0)
  15. s1.erase(n,s2.length());//s1.erase(da dovei nizia,quanto รจ lunga la parola) serve per cancellare le sottostringhe
  16. cout <<s1;
  17. return 0;
  18. }