title: My counter is not properly being divided by str.length(). C++
body: <p>I just need some help dividing my counter of the Gs and Cs in the string/DNA strand and divide those by the length of the DNA strand to get a double representing the percentage of Cs and Gs in the string. However, when I divide counter by DNA.length() it returns 0. it doesn't give me the actual answer/ by product. Please help!!</p>
  <pre><code>    #include &lt;iostream&gt;
      #include&lt;string&gt;
      using std::string; using std::cout; using std::endl; using std::cin;
  
      double get_gc_content(const string&amp; dna)
      {
        int counter = 0;
  
          for(std::size_t i = 0; i &lt; dna.size();++i)
          {
              if(char(dna[i]=='C') || char(dna[i]=='G'))
              {
                  counter++;
                  // cout&lt;&lt;counter&lt;&lt;endl;     
              }
  
          }
        cout&lt;&lt;counter&lt;&lt;endl;
  
        double gc_content = counter / dna.length();
  
        return gc_content;
      }
  
  
      int main()
      {
        std::string dna = &quot;ACCGCAAATT&quot;;
  
        double gc_count;
  
        gc_count = get_gc_content(dna);
        
        cout&lt;&lt;gc_count&lt;&lt;endl;
  
        return 0;
      } 
  </code></pre>