title: Displaying all prefixes of a word in C++
body: <p>I am trying to do is display all the suffixes of a word as such:</p>
  
  <p>word:  <code>house</code></p>
  
  <p>print:</p>
  
  <pre><code>h
  ho
  hou
  hous
  house
  </code></pre>
  
  <p>What I did is:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string.h&gt;
  
  using namespace std;
  
  int main()
  {
     char cuvant[100];
     int i,k;
  
     cin&gt;&gt;cuvant;
  
     for(i=0;i&lt;strlen(cuvant);i++)
     {
         for(k=0;k&lt;i;k++)
         {
             if(k==0)
             {
                 cout&lt;&lt;cuvant[k]&lt;&lt;endl;
             }else
             {
               for(k=1;k&lt;=i;k++){
                   if(k==i) cout&lt;&lt;endl;
                   cout&lt;&lt;cuvant[k];
               }
             }
         }
     }
  }
  
  </code></pre>
  
  <p>What am I doing wrong?</p>