title: 1.#QNAN error C++
body: <p>I am new to programming and trying to write a new program.  While checking through my program it is returning the error code 1.#QNAN.  I have tried isolating the variable and researching for answers but cannot find any solutions.</p>
  
  <p>My code:</p>
  
  <pre><code> // This is a program to decide what culvert should be properly used for a specific installation
  // using given measurements and data
  //
  #include &lt;cstdio&gt;
  #include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  // initializing functions 
  double slope_function();
  double cbasin();
  // initializing classes: Subdivisions specs
  
  //intitializing global variables
  double edge_road =0;
  double up_stream  =0;
  double down_stream =0;
  double tbm =0.0;
  
  //double culv_length =0;
  double slope = 0.0 ;
  char street_name[1001];
  int min_culv = 15;
  double up_strm_culv =0;
  double dwn_strm_culv =0;
  
  
  int main (int nNumberofArgs, char* pszArgs[])
  {
      cout&lt;&lt; "This program will allow the surveyor to double check their calculations\n";
      cout &lt;&lt; "in deciding what size, type, and requirements are allowed for the\n";
      cout &lt;&lt; "installation of culverts in Terrebonne Parish.\n\n";
  
  
  
  // begin input
     cout &lt;&lt; "what is the name of the street\nwhere the culverts will be installed: ";
     cin.getline (street_name,1000);
     cout &lt;&lt; endl;
     cout &lt;&lt; "What is the Benchmark: ";
     cin &gt;&gt; tbm;
     cout &lt;&lt; endl;
     cout &lt;&lt; "What is the elevation of the edge of the road: ";
     cin &gt;&gt; edge_road;
     cout &lt;&lt; endl;
     cout &lt;&lt; "What is the up-stream culvert size: ";
     cin &gt;&gt; up_strm_culv;
     cout &lt;&lt; endl;
     cout &lt;&lt; "What is the culverts up-stream inverted elevation: ";
     cin &gt;&gt; up_stream;
     cout &lt;&lt; endl;
     cout &lt;&lt; "What is the down-stream culvert size: ";
     cin &gt;&gt; dwn_strm_culv;
     cout &lt;&lt; endl;
     cout &lt;&lt; "What is the culverts down-stream inverted elevation: ";
     cin &gt;&gt; down_stream;
     cout &lt;&lt; endl;
     cout &lt;&lt; "What is the length of culvert requested: ";
     cin &gt;&gt; culv_length;
  
  
     cout &lt;&lt; "Your slope is : "; 
     cout &lt;&lt; slope_function();
     cout &lt;&lt; endl;
     cout &lt;&lt; street_name;
     cout &lt;&lt; endl;
     cout &lt;&lt; cbasin();
  
  
      cout &lt;&lt; endl;
    // wait until user is ready before terminating program
    // to allow the user to see the program results 
    system ("pause");
    return 0;
  }  
  
  // slope function 
  double slope_function()
  {
      double riseoverrun = 0.0;
      slope = (up_stream - down_stream)/ culv_length;
      return slope;
  }
  
  
  // Catch Basin function
  double cbasin ( )
  {
      double cb = 0;
      cb = culv_length / 60;
      cout &lt;&lt; endl;
      cout &lt;&lt; "You need ";
     cout &lt;&lt; cb;
     cout &lt;&lt; " catch basins for this job.";
     cout &lt;&lt; endl;
  }
  </code></pre>