title: Basic Food Bank program help needed
body: <p>I'm having an issue in the code below for option 2 which is the request. Each time I print out the request table, instead of it showing the pending requests inputted by the user, it gives me a random high number. Can someone help me find the issue? The code should be similar to option 1, but it shouldn't add up the user inputs if its the same request. Example Output: </p>
  
  <pre><code>1
  Milk 20
  1
  Milk 20
  2
  Milk 10
  2
  Milk 5
  4
  Donations: 
  Milk 40
  Requests: 
  Milk 10
  Milk 5
  </code></pre>
  
  <p>This is my code</p>
  
  <pre><code>int main() {
  
  int don_count=0, don_amt[100], found, i, don_quant, option, req_count=0, req_amt[100],req_quant;
  
  char word[20], don_inv_type[100][20], req_word[20], req_inv_type[100][20];
  
  printf("Welcome to the food bank program!);
  printf("1.Enter a Donation\n2.Enter a Request\n3.Fulfill the earliest Request\n4.Print status report\n5.Exit\n");
  scanf("%d", &amp;option);
  
  while (option != 5) {
  
        // Execute a deposit.
        if (option == 1) {
                   scanf ("%s", word);
                   scanf ("%d", &amp;don_quant);
                   found = -99;
                   for (i=0;i&lt;don_count; i++){
                       if (strcmp(don_inv_type[i], word)==0)
                       found = i;
                       }
                   if (found == -99){
                                 strcpy(don_inv_type[i],word);
                                 don_amt[i] = don_quant;
                                 don_count ++;
                                 }
                   else
                           don_amt[found] += don_quant;
        }
  
        else if (option == 2) {
             scanf ("%s", req_word);
             scanf ("%d", &amp;req_quant);
             req_count++;
             for(i=0; i&lt;req_count; i++)
             {
                      strcpy(req_inv_type[i],req_word);
                      req_amt[i] += req_quant;
             }
        }
  
        else if (option == 3) {
  
  
        }
  
        else if (option == 4) {
             printf("Donations:\n");
             for(i=0;i&lt;don_count;i++){
                                      printf("%8s", don_inv_type[i]);
                                      printf("%5d\n", don_amt[i]);
                                      }
             printf("Requests: \n");
             for(i=0;i&lt;req_count;i++){
                                      printf("%8s", req_inv_type[i]);
                                      printf("%5d\n", req_amt[i]);
                                      }
  
  
        }
  
        else if (option == 5) {
             printf(" Thanks bye");     
  
        }
  
        // Reprompt the menu.
        printf("1.Enter a Donation\n2.Enter a Request\n3.Fulfill the earliest Request\n4.Print status report\n5.Exit\n\n");
        scanf("%d", &amp;option);
  } // end while
  
  system("PAUSE");
  return 0;
  } // end main
  </code></pre>