title: C++ String Variable Declaration
body: <p>I'm having some trouble declaring a string variable. Code and the errors are here: <a href="http://pastebin.com/TEQCxpZd" rel="noreferrer">http://pastebin.com/TEQCxpZd</a> Any thoughts on what I'm doing wrong? Also, please keep it platform independent. Thanks!</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
      string input; //Declare variable holding a string
  
      input = scanf; //Get input and assign it to variable
      printf(input); //Print text
      return 0;
  }
  
  
  Getting this from GCC:
  
  main.cpp: In function ‘int main()’:
  main.cpp:53:10: error: invalid conversion from ‘int (*)(const char*, ...)’ to ‘char’
  main.cpp:53:10: error:   initializing argument 1 of ‘std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp; std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::operator=(_CharT) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;, _Alloc = std::allocator&lt;char&gt;, std::basic_string&lt;_CharT, _Traits, _Alloc&gt; = std::basic_string&lt;char&gt;]’
  main.cpp:54:14: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘int printf(const char*, ...)’
  </code></pre>