I need to make a function to print "=" under the user, but because variable was declared with main() the parameter isn't seen by the function : <p>I need to print "=" under the input taken from the user, I'm not sure whether to use a loop or printf(), but because string title is declared within main() my function doesn't see it as a parameter.</p>

<p><a href="https://i.stack.imgur.com/5pWmn.jpg" rel="nofollow noreferrer">Error Message</a></p>

<pre><code>//#include "stdafx.h" // Header File used VS.
#include &lt;iostream&gt;
//#include &lt;iomanip&gt; // Used to format the output.
#include &lt;cstdlib&gt; // Used for system().
#include &lt;math.h&gt; // Used for sqrt().
#include &lt;stdio.h&gt;  /* printf, NULL */
#include &lt;time.h&gt;  /* time */
using namespace std;// ?
#include &lt;string&gt; // Used to work with srings.

string print_title (title);

int main (){

    string title;

    cout &lt;&lt; "Enter a title: " &lt;&lt; endl;
    cin &gt;&gt; title;

    system("PAUSE"); // Pauses the program before termination.
    return 0;
}

string print_title (title){
    cout &lt;&lt; title &lt;&lt; endl;
    int length = title.length();
    printf("=", length);
    /*for (int i=0; i&lt;=length, i++){
        cout &lt;&lt; "=" &lt;&lt; endl;
    }*/
}
</code></pre>
