// july29ex1.cpp : Defines the entry point for the console application.
// This program inputs exactly 10 bills, and totals them by creditor
//  number (a number 1 - 20)

#include "stdafx.h"
#define max_creditor 200

int main(int argc, char* argv[])
{  int num_of_bills, bill, which_creditor, pos;

    float creditors [max_creditor+1] = {0.0};

	float amt;
    

	printf("How many bills do you have? ");

    scanf("%d", &num_of_bills);

    for (bill=1; bill<= num_of_bills; bill++) {

		do  {
		printf("Type vendor (1 - %d) and dollar amt for bill #%d ", 
		      max_creditor, bill);
	   scanf("%d%f", &which_creditor, &amt);

	   if ( (which_creditor >= 1) && (which_creditor <= max_creditor) )

		 creditors[which_creditor] = creditors [which_creditor] + amt;
	    else
			printf("Sorry!  Bad creditor number.  Transaction rejected!! Please retype!\n"); }
	  while ( (which_creditor < 1) || (which_creditor > max_creditor) );

	}/* end for bill */

	for (pos=1; pos<=max_creditor; pos++)
      if (creditors[pos] > 0)
		printf("Creditor %d is owed a total of $%6.2f \n", pos, creditors[pos] );


	

	return 0;
}