title: Errors in c++ code and how to fix them
body: <p>I have one little problem with some code in C++
  It won't compile, my skills in programing aren't too high right now,
  if you could help me I would be thankful.
  Ty in advance.</p>
  
  <p>The question is WHERE are the errors, and HOW to fix the code</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  struct S {
        S(int i){ this-&gt;x = i;}
        ~S(){}
      int x;
      static const int sci = 200;
      int y = 999; 
  }
  void main(){
      S *ps = new S(300);
      ps-&gt;x = 400;
  
      S s;
      s.x = 500;
  }
  </code></pre>
  
  <p>compiler output:</p>
  
  <pre><code>8   13  [Warning] non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
  9   1   [Error] expected ';' after struct definition
  10  11  [Error] '::main' must return 'int'
  In function 'int main()':
  14  7   [Error] no matching function for call to 'S::S()'
  14  7   [Note] candidates are:
  4   7   [Note] S::S(int)
  4   7   [Note] candidate expects 1 argument, 0 provided
  3   8   [Note] S::S(const S&amp;)
  3   8   [Note] candidate expects 1 argument, 0 provided
  </code></pre>
  
  <p>======== AFTERMATCH ;) ===========</p>
  
  <p>code:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  struct S {
      S() : x() {}       // default constructor
      S(int i) : x(i) {} // non-default constructor
      ~S(){} // no need to provide destructor for this class
      int x;
      static const int sci = 200;
      int y = 999; // Only valid since C++11
  }; // ; after class definition.
  int main(){
      S *ps = new S(300);
      ps-&gt;x = 400;
  
      S s;
      s.x = 500;
  }
  </code></pre>
  
  <p>as well as:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  struct S {
      S(int i){
          this-&gt;x = i;
      }
      ~S(){}
      int x;
      static const int sci = 200;
      int y = 999;
  };
  int main(){
      S *ps = new S(300);
      ps-&gt;x = 400;
      S *s = new S(20);
      s-&gt;x = 500;
  }
  </code></pre>
  
  <p>worked!
  TY to juanchopanza, Paul Renton and all others who spared their time to help me with this!</p>