title: Running the executable does nothing
body: <p>I was writing a sample example involving multiple files. The detailed code is as follows. </p>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;algorithm&gt;
  #include &lt;iomanip&gt;
  #include &lt;ios&gt;
  #include &lt;iostream&gt;
  #include &lt;stdexcept&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include "grade.h"
  #include "Student_Info.h"
  
  using std::cin;
  using std::cout;
  using std::domain_error;
  using std::endl;
  using std::max;
  using std::setprecision;
  using std::sort;
  using std::streamsize;
  using std::string;
  using std::vector;
  
  int main()
  {
      vector&lt;Student_Info&gt; students;
      Student_Info record;
      string::size_type maxlen = 0;       //the length of the longest name
  
      //read and store all the student's data
      //Invariant: students contains all the student records read so far
      //maxlen contains the length of the longest name in students
      while(read(cin,record))
      {
          //find length of the longest name
          maxlen=max(maxlen,record.name.size());
          students.push_back(record);
      }
  
      //alphabetize the student records
      sort(students.begin(),students.end(),compare);
  
      //write the names and grades
      for(vector&lt;Student_Info&gt;::size_type i=0; i!=students.size();++i)
      {
          //write the name, padded to the right to maxlen + 1 characters
          cout &lt;&lt; students[i].name &lt;&lt; string(maxlen+1-students[i].name.size(),' ');
  
          //compute and write the grade
          try
          {
              double final_grade=grade(students[i]);
              streamsize prec = cout.precision();
              cout &lt;&lt; setprecision(3) &lt;&lt; final_grade &lt;&lt; setprecision(prec);
          }
          catch(domain_error e)
          {
              cout &lt;&lt; e.what();
          }
  
          cout &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Student_info.{h,cpp}</p>
  
  <pre><code>#ifndef GUARD_Student_Info
  #define GUARD_Student_Info
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  using std::iostream;
  using std::string;
  using std::vector;
  
  struct Student_Info
  {
      std::string name;
      double midterm,final;
      std::vector&lt;double&gt; homework;
  };
  
  bool compare(const Student_Info&amp;, const Student_Info&amp;);
  std::istream&amp; read(std::istream&amp;, Student_Info&amp;);
  std::istream&amp; read_hw(std::istream&amp;, std::vector&lt;double&gt;&amp;);
  
  #endif
  #include "Student_Info.h"
  
  using std::istream;
  using std::vector;
  
  bool compare(const Student_Info&amp; x, const Student_Info&amp; y)
  {
      return x.name &lt; y.name;
  }
  
  istream&amp; read(istream&amp; is, Student_Info&amp; s)
  {
      is &gt;&gt; s.name &gt;&gt; s.midterm &gt;&gt; s.final;
  
      read_hw(is,s.homework); //read and store all the students' homework grades
      return is;
  }
  
  istream&amp; read_hw(istream&amp; in, vector&lt;double&gt;&amp; hw)
  {
      if(in)
      {
          //get rid of previous contents
          hw.clear();
  
          //read homework grades
          double x;
          while(in&gt;&gt;x)
           hw.push_back(x);
  
          //clear the stream so that the input would work for the next student
          in.clear();
      }
  
      return in;
  }
  </code></pre>
  
  <p>grade.{h,cpp}</p>
  
  <pre><code>#ifndef GRADE_H
  #define GRADE_H
  
  //grade.h
  #include &lt;vector&gt;
  #include "Student_Info.h"
  
  double grade(double,double,double);
  double grade(double,double,const std::vector&lt;double&gt;&amp;);
  double grade(const Student_Info&amp;);
  
  #endif
  
  #include &lt;stdexcept&gt;
  #include &lt;vector&gt;
  
  #include "median.h"
  #include "grade.h"
  
  
  double grade(const Student_Info&amp; s)
  {
      return grade(s.midterm,s.final,s.homework);
  }
  
  double grade(double midterm, double final, const vector&lt;double&gt;&amp; hw)
  {
      if(hw.size()==0)
          throw domain_error("student has done no homework");
      return grade(midterm, final, median(hw));
  }
  
  double grade(double midterm,double final,double homework)
  {
      return 0.2*midterm + 0.4*final + 0.4*homework;
  }
  </code></pre>
  
  <p>median.{h,cpp}</p>
  
  <pre><code>#ifndef MEDIAN_H
  #define MEDIAN_H
  
  #include &lt;vector&gt;           
  #include &lt;stdexcept&gt;        //to get the declaration of domain_error
  #include &lt;algorithm&gt;        //to get the declaration of sortt
  
  using std::domain_error;
  using std::sort;
  using std::vector;
  
  double median(std::vector&lt;double&gt;);
  
  #endif
  #include "median.h"
  
  double median(vector&lt;double&gt; vec)
  {
      typedef vector&lt;double&gt;::size_type vec_sz;
  
      vec_sz size=vec.size();
      if(size==0)
          throw domain_error("median of an empty vector");
      sort(vec.begin(),vec.end());
  
      vec_sz mid=size/2;
  
      return size%2==0 ? (vec[mid]+vec[mid-1])/2:vec[mid];
  }
  </code></pre>
  
  <p>The problem is when I compile it using g++ on linux and run ./a.out nothing happens. This is strange. I have gone over the code but couldn't find anything untoward. Hopefully someone can find the glitch. </p>