title: printf is not printing the data I want
body: <p>Problem:</p>
  
  <p>Trouble With Printf and Scanf</p>
  
  <p>Goal:</p>
  
  <p>Intermediate Programming Coursework:
      Build a Garden Store.</p>
  
  <p>At this point, All that is required is to enter a string of data (in a particular pattern) about the store such as start up costs, employee costs, square footage, etc ALL ON A SINGLE LINE. Then display them in a semi-meaningful manner.</p>
  
  <p>Code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  #define MAXSTRING       100 
  
  #define MAXROOMS        20
  #define MAXSTAFF        30  
  
  #define ANNUAL          0
  #define WATER_PERENNIAL 1
  #define XERIC_PERENNIAL 2
  #define NATIVE_SHRUB    3
  #define NATIVE_TREE     4
  #define OTHER           5   
  
  #define AMOUNT          0
  #define AVGPRICE        1
  #define MARKUP          2   
  
  #define MANAGER         0
  #define OWNER           1
  #define HORTICULTARIST  2
  #define SALES_STAFF     3   
  
  #define AVAILABLE       0
  #define HRWAGES         1
  #define MOHOURS         2   
  
  #define INDOOR          0
  #define LOADING         1
  #define OUTDOOR         2
  #define BATHROOM        3
  #define OFFICE          4   
  
  #define LENGTH          0
  #define WIDTH           1
  
  int main(void)
  {
  
  // Arrays
      float   stockinfo[6][3], staffdata[4][3], roomsize[5][18][2];
              /*
                  --&gt;stockinfo [stock type(6)] [Quantity / Cost / percent Markup]
                  --&gt;staffdata [staff type(4)] [Quantity / wage / Hrs. per Mo.]
                  --&gt; roomsize [room  type(5)] [Room # (i.e. Bathroom #2)] [Length / Width]
              */
      int     roomtype[5], stafftype[4];
      char    sectionname[36][40];
      char    Nstock[6], Nstaff[4], Nrooms[5];
              /*
                  N____[ ]: Stock/Staff/Room code (single letter)
              */
  
  // Counters
      int i=0, j=0, k=0, l=0;
  
  // Variables
      float   CBL, CPU, CWU, CBP, CSF, maxwage, O_RSF, I_RSF;
          /* 
             CBL:Cost of Business License ~$500
             CPU:Cost of Power Utility Connection fee ~$250.00
             CWU:Cost of Water Utility Connection fee ~$69.99
             CBP:Cost of Business Permit ~$50.00
             CSF:Cost of Start-up Fund ~$15,000.00
          */
      int Qstock, Qstaff, Qrooms; 
          /*Number of different types of (Stock, Staff, or Rooms) */
      char    Z; 
          /* Character place holder */
  
  // Code:
      printf("prompt&gt;");
      scanf("%f %f %f %f %f", &amp;CBL, &amp;CPU, &amp;CWU, &amp;CBP, &amp;CSF);
      scanf("%d", &amp;Qstock);
  
      for(i=0; i&lt;Qstock; i++)
          scanf(" %c", &amp;Nstock[i]);
      for(j=0; j&lt;3; j++)
      {
          for(i=0; i&lt;Qstock; i++)
          {
              Z = Nstock[i];
              switch( Z )
              {
                  case 'A': scanf(" %f", &amp;stockinfo[ANNUAL][j]);
                      break;
                  case 'W': scanf(" %f", &amp;stockinfo[WATER_PERENNIAL][j]);
                      break;
                  case 'X': scanf(" %f", &amp;stockinfo[XERIC_PERENNIAL][j]);
                      break;
                  case 'N': scanf(" %f", &amp;stockinfo[NATIVE_SHRUB][j]);
                      break;
                  case 'T': scanf(" %f", &amp;stockinfo[NATIVE_TREE][j]);
                      break;
                  case 'O': scanf(" %f", &amp;stockinfo[OTHER][j]);
                      break;
                  default : scanf(" %f", &amp;stockinfo[OTHER][j]);
                      break;
              }
          }
      }
  
      scanf("%d", &amp;Qstaff);
  
      for(i=0; i&lt;Qstaff; i++)
          scanf(" %c", &amp;Nstaff[i]);
      for(j=0; j&lt;3; j++)
      {
          for(i=0; i&lt;Qstaff; i++)
          {
              Z = Nstaff[i];
              switch( Z )
              {
                  case 'M': scanf(" %f", &amp;staffdata[MANAGER][j]);
                      break;
                  case 'H': scanf(" %f", &amp;staffdata[HORTICULTARIST][j]);
                      break;
                  case 'O': scanf(" %f", &amp;staffdata[OWNER][j]);
                      break;
                  case 'S': scanf(" %f", &amp;staffdata[SALES_STAFF][j]);
                      break;
                  default : scanf(" %f", &amp;staffdata[SALES_STAFF][j]);
                      break;
              }
          }
      }
  
      scanf(" %f", &amp;maxwage);
  
      scanf( "%d", &amp;Qrooms);
  
      for(i=0; i&lt;Qrooms; i++)
          scanf(" %c", &amp;Nrooms[i]);
      for(i=0; i&lt;Qrooms; i++)
      {
          Z = Nrooms[i];
          switch( Z )
          {
              case 'I': scanf(" %d", &amp;roomtype[INDOOR]);
                  break;
              case 'L': scanf(" %d", &amp;roomtype[LOADING]);
                  break;
              case 'S': scanf(" %d", &amp;roomtype[OUTDOOR]);
                  break;
              case 'B': scanf(" %d", &amp;roomtype[BATHROOM]);
                  break;
              case 'O': scanf(" %d", &amp;roomtype[OFFICE]);
                  break;
          }
      }
  
      scanf(" %f %f", &amp;I_RSF, &amp;O_RSF);
  
  /*********************************************************************************************
  
                      End of Input
  
  *********************************************************************************************/
  
      for(i=0; i&lt;Qrooms; i++)
      {
          Z = Nrooms[i];
          switch( Z )
          {
              case 'I': for(j=0; j&lt;roomtype[INDOOR]; j++)
                  {
                      scanf(" %f %f %s", &amp;roomsize[INDOOR][j][LENGTH], &amp;roomsize[INDOOR][j][WIDTH], &amp;sectionname[k]);
                      k++;
                  }
                      break;
              case 'L': for(j=0; j&lt;roomtype[LOADING]; j++)
                  {
                      scanf(" %f %f", &amp;roomsize[LOADING][j][LENGTH], &amp;roomsize[LOADING][j][WIDTH]);
                      k++;
                  }
                      break;
              case 'S': for(j=0; j&lt;roomtype[OUTDOOR]; j++)
                  {
                      scanf(" %f %f %s", &amp;roomsize[OUTDOOR][j][LENGTH], &amp;roomsize[OUTDOOR][j][WIDTH], &amp;sectionname[k+18]);
                      k++;
                  }
                      break;
              case 'B': for(j=0; j&lt;roomtype[BATHROOM]; j++)
                  {
                      scanf(" %f %f", &amp;roomsize[BATHROOM][j][LENGTH], &amp;roomsize[BATHROOM][j][WIDTH]);
                      k++;
                  }
                      break;
              case 'O': for(j=0; j&lt;roomtype[OFFICE]; j++)
                  {
                      scanf(" %f %f", &amp;roomsize[OFFICE][j][LENGTH], &amp;roomsize[OFFICE][j][WIDTH]);
                      k++;
                  }
                      break;
              default :   break;
          }
      }
  
  
      printf("\n\n\n CBL: $%9.2f\n CPU: $%9.2f\n CWU: $%9.2f\n CBP: $%9.2f\n CSF: $%9.2f\n\n   %d:", CBL, CPU, CWU, CBP, CSF, Qstock);
  
      for(i=0; i&lt;Qstock; i++)
          printf(" %c", Nstock[i]);
      for(j=0; j&lt;3; j++)
      {
          printf("      \n");
          for(i=0; i&lt;6; i++)
          {
              printf(" %9.2f", stockinfo[i][j]); 
          }
      }
  
      printf("\n\n   %d:", Qstaff);
  
      for(i=0; i&lt;Qstaff; i++)
          printf(" %c", Nstaff[i]);
      for(j=0; j&lt;3; j++)
      {
          printf("      \n");
          for(i=0; i&lt;4; i++)
          {
              printf(" %9.2f", staffdata[i][j]); 
          }
      }
  
      printf("\n\n %9.2f\n", maxwage);
  
      printf("\n   %d:", Qrooms);
  
      for(i=0; i&lt;Qrooms; i++)
          printf(" %c", Nrooms[i]);
  
      printf("\n");
      for(i=0; i&lt;4; i++)
      {
          printf(" %9d", roomtype[i]); 
      }
  
  
      printf("\n\n %9.2f %9.2f\n\n\n\n", I_RSF, O_RSF);
  
      k=0;
  
      for(i=0; i&lt;Qrooms; i++)
      {
          Z = Nrooms[i];
          switch( Z )
          {
              case 'I': for(j=0; j&lt;roomtype[INDOOR]; j++)
                  {
                  printf(" %9.2f %9.2f     %s\n", roomsize[INDOOR][j][LENGTH], roomsize[INDOOR][j][WIDTH], sectionname[k]);
                  k++;
                  }
                  break;
              case 'L': for(j=0; j&lt;roomtype[LOADING]; j++)
                  {
                  l=j+1;
                  printf(" %9.2f %9.2f     Loading Dock %d\n", &amp;roomsize[LOADING][j][LENGTH], &amp;roomsize[LOADING][j][WIDTH], l);
                  k++;
                  }
                  break;
              case 'S': for(j=0; j&lt;roomtype[OUTDOOR]; j++)
                  {
                  printf(" %9.2f %9.2f     %s\n", &amp;roomsize[OUTDOOR][j][LENGTH], &amp;roomsize[OUTDOOR][j][WIDTH], sectionname[k+18]);
                  k++;
                  }
                  break;
              case 'B': for(j=0; j&lt;roomtype[BATHROOM]; j++)
                  {
                  l=j+1;
                  printf(" %9.2f %9.2f     Bathroom %d\n", &amp;roomsize[BATHROOM][j][LENGTH], &amp;roomsize[BATHROOM][j][WIDTH], l);
                  k++;
                  }
                  break;
              case 'O': for(j=0; j&lt;roomtype[OFFICE]; j++)
                  {
                  l=j+1;
                  printf(" %9.2f %9.2f     Office %d\n", &amp;roomsize[OFFICE][j][LENGTH], &amp;roomsize[OFFICE][j][WIDTH], l);
                  k++;
                  }
                  break;
              default : break;
          }
      }
  
      printf("There are %d rooms.\n\n", l);
  return 0;
  }
  </code></pre>
  
  <p>INPUT:</p>
  
  <pre><code>500.00 250.00 69.99 50.00 15000.00 
  4 X A N O 65 500 150 325 35.50 2.00 22.00 7.25.75 .90 1.00 .90 
  3 M H S 2 1 5 12.50 18.00 10.10 120 48.8 76.4 27.50 
  4 S I B L 3 1 2 3 
  120.00 75.50
  
  40.0 60.0 Hardy_Shrubs
  20.0 20.0 Native_Shrubs
  20.0 20.0 Hardy_Trees
  45.5 35.3 Flowers
  10.5 10.0
  9.5 10.0
  15.0 10.0
  10.0 5.0
  20.0 10.0
  </code></pre>
  
  <p>which represents: </p>
  
  <pre><code>business license cost of            $500.00
  power utility connection cost of    $250
  water utility connection fee of     $69.99
  business permit cost of             $50
  start up fund of                    $15,000
  
  Stock Type(4):      Quantity    Cost        Markup
  xeric perennials    65          $35.50      0.75
  annuals             500         $ 2.00      0.90
  native shrubs       150         $22.00      1.00
  and other           325         $ 7.25      0.90
  
  Staff Type(3):      Quantity    Hourly-Wage Hours-worked-per-month  
  managers            2           $12.50      120
  horticulturists     1           $18.00      48.58
  sales staff         5           $10.10      76.4
  
  The maximum hourly wage for any employee is $27.50.  
  
  Room Type(4):       Quantity
  Outdoor Sales       3
  Indoor Sales        1
  Bathrooms           2
  Loading Areas       3
  
  The rental rate per indoor square foot per year is $120.00.  
  The rental rate per outdoor square foot per year is $75.50. 
  </code></pre>
  
  <p>The remaining data is one line for each room.<br>
  The order of the lines matches the order of the rooms given so 
  3 outdoor sales rooms, 1 indoor sales room, 2 bathrooms, and 3 loading areas is 9 lines.  </p>
  
  <p>For sales rooms there is length, width, then room name. In the example above:</p>
  
  <p>The first outdoor sales room is 40' by 60',  and it is named "Hardy_Shrubs".<br>
  The second outdoor sales room is 20' x 20' and is called "Native_Shrubs."<br>
  Likewise for the third outdoor sales room called "Hardy_Trees". 
  The fourth room is the 45.5' x 35.3' indoor sales room names "Flowers".<br>
  The 5th room is the first bathroom of size 10.5' by 10' and the second bath is 9.5' x 10'.  The Three loading areas are 15' x 10', 10' x 5' and 20' x 10' in size.</p>
  
  <p>This data is then printed when main reaches /<strong>* End of Input *</strong>/</p>
  
  <p>Unfortunately, This is what gets printed:</p>
  
  <pre><code> CBL: $   500.00
   CPU: $   250.00
   CWU: $    69.99
   CBP: $    50.00
   CSF: $ 15000.00
  
     4: X A N O      
      500.00      0.00     65.00    150.00      0.00    325.00      
        2.00      0.00     35.50     22.00      0.00      7.25      
        0.90      0.00      0.75      1.00     -0.00      0.90
  
     3: M H S      
        2.00      0.00      1.00      5.00      
       12.50      0.00     18.00     10.10      
      120.00      0.00     48.80     76.40
  
       27.50
  
     4: S I B L
       1         3         3         2
  
      120.00     75.50   /* &lt;-- Correct */
  
      /* ERROR SECTION */
  
      120.00     75.50                                /* wrong */  
      120.00     75.50                                /* wrong */
      120.00     75.50                                /* wrong */
       45.50     35.30     Flowers                    /* Correct! */
       45.50     35.30     Bathroom 1826556656        /* wrong */
                                                      /* Should be: 10.50     10.00   Bathroom 1 */
       45.50     35.30     Bathroom 1826556664        /* wrong */
       45.50     35.30     Loading Dock 1826556368    /* wrong */
       45.50     35.30     Loading Dock 1826556376    /* wrong */
       45.50     35.30     Loading Dock 1826556384    /* wrong */
  </code></pre>
  
  <p>/<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**</strong>/</p>
  
  <pre><code>       QUESTION
  </code></pre>
  
  <p>/<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**</strong>/</p>
  
  <p>I've been staring at this for hours.</p>
  
  <p>Why do the room dimensions start out as the prices per square foot, then change to the correct values for the indoor flower area, then keep the same dimensions for the remaining rooms?</p>
  
  <p>Also Why does it print:</p>
  
  <p>Loading Dock 1826556368 </p>
  
  <p>Loading Dock 1826556376</p>
  
  <p>Loading Dock 1826556384 </p>
  
  <p>instead of:</p>
  
  <p>Loading Dock 1</p>
  
  <p>Loading Dock 2</p>
  
  <p>Loading Dock 3</p>
  
  <p>??????????</p>