title: Finding substring of string
body: <p>So, I'm just starting out this C++ course and we are doing strings now. For this assignment, what my professor wants me to do is to find a string within a string and to print it out and at a position. This is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
  cout &lt;&lt; "Please enter a phrase: " &lt;&lt; endl;
  string phrase;
  getline(cin, phrase);
  
  cout &lt;&lt; "Please enter a possible substring of the phrase: " &lt;&lt; endl;
  string phrase_2;
  getline(cin, phrase_2);
  
  string pos = phrase.substr(phrase_2);
  cout &lt;&lt; phrase_2 &lt;&lt; "was found at position " &lt;&lt; pos &lt;&lt; endl;
  return 0;
  
  }
  </code></pre>
  
  <p>I have tried multiple hours trying to get the code to print out the position. This might be totally wrong and I apologize for that, but if you could help me out, I would appreciate it.</p>