Help with source code!

I am trying to write a program in C that simulate the billing of a telephone company. It should calculate the length of the call and the cost of the call. I am haveing trouble with adding an array where the summary shows the start time and end time of each call per customer. ***For example, Call 1 started at 23:45 and ended at 0:15. The duration of call 1 is 30 minutes.*** Below is a copy of my code that I have currently. Can You Help?!?
Thanks

#include <stdio.h>
#define reg_rate 0.25
#define discount 0.10
#define tax_rate 0.08
#define pm_discount 0.40

double Total_Time(double);
double Call_Cost(double);
double cost[10];

double tax, total_cost, sub_total, sub_total1, sub_total2,
       grand_total, cust_total, total_time;

int    response, hrs, min, end_hrs, end_min, cust_count, call_count, time_total, cust_time, cust_call_count;

main()
{
printf("\n*******Eastern Atlantic Telephone company*******\n\n");
  cust_count = 0;
  call_count = 0;
  grand_total = 0;
  time_total = 0;
  cust_time = 0;
  cust_call_count = 0;

  printf("\nDo you have a customer to process?");
  printf("\nEnter 1 for yes or 0 for No: ");
  scanf("%d", &response);
   while (response == 1)
    {
     cust_time = 0;
     cust_total = 0;
     ++cust_count;
     cust_call_count = 0;

     printf("\nEnter the start time of the call: ");
     scanf("%d:%d", &hrs, &min);
      if ((hrs >= 24) || (hrs < 0) || (min >=60) || (min < 0 ))
       {
        hrs = 0;
        min = 0;
        printf("\nThe time entered is incorrect!");
        printf("\nEnter the start time of the call: ");
        scanf("%d:%d", &hrs, &min);
       }

   printf("Enter the end time of the call: ");
   scanf("%d:%d", &end_hrs, &end_min);
   if ((end_hrs >= 24) || (end_hrs < 0) || (end_min >=60) ||  (end_min < 0 ))
       {
        end_hrs = 0;
        end_min = 0;
        printf("\nThe time entered is incorrect!");
        printf("\nEnter the end time of the call: ");
        scanf("%d:%d", &end_hrs, &end_min);
       }

     ++cust_call_count;
     ++call_count;

     total_time = Total_Time(total_time);
     total_cost = Call_Cost(total_cost);
     cost[10] = total_cost;

     printf("\nThe duration for this call is %.2f minutes.", total_time);

     cust_total += total_cost;
     time_total += total_time;
     cust_time += total_time;

     printf("\nDo you have a another call to process?");
     printf("\nEnter 1 for yes or 0 for No: ");
     scanf("%d", &response);
      while (response == 1)
       {
        ++cust_call_count;
        ++call_count;

        printf("\nEnter the start time of the call: ");
        scanf("%d:%d", &hrs, &min);
         if ((hrs >= 24) || (hrs < 0) || (min >=60) || (min < 0 ))
          {
           hrs = 0;
           min = 0;
           printf("\nThe time entered is incorrect!");
           printf("\nEnter the start time of the call: ");
           scanf("%d:%d", &hrs, &min);
          }

        printf("Enter the end time of the call: ");
        scanf("%d:%d", &end_hrs, &end_min);
         if ((end_hrs >= 24) || (end_hrs < 0) || (end_min >=60) || (end_min < 0 ))
          {
           end_hrs = 0;
           end_min = 0;
           printf("\nThe time entered is incorrect!");
           printf("\nEnter the end time of the call: ");
           scanf("%d:%d", &end_hrs, &end_min);
          }

        total_time = Total_Time(total_time);
        total_cost = Call_Cost(total_cost);
        cost[10] = total_cost;
     printf("\nThe duration for this call is %.2f minutes.", total_time);


     time_total += total_time;
     cust_total += total_cost;
     cust_time += total_time;

     printf("\nDo you have a another call to process?");
     printf("\nEnter 1 for yes or 0 for No: ");
     scanf("%d", &response);
    }
  printf("\n******Customer Summary Report******");

  printf("\nThe total number of calls is %d.", cust_call_count);
  printf("\nThe total time for this customer is %d minutes.", cust_time);
  printf("\nThe total for theis customer is $%.2f", cust_total);

  grand_total += cust_total;

  printf("\nDo you have a customer to process?");
  printf("\nEnter 1 for yes or 0 for No: ");
  scanf("%d", &response);
 }
printf("\nThe Grand Total is $%5.2f.", grand_total);
printf("\nThe Total Number of calls is %d.", call_count);
printf("\nThe Total Time used by all customers is %d minutes.", time_total);
printf("\nThe Total Number fo customers is %d.", cust_count);
}

double Total_Time(double total_time)
{
 if ((end_min < min ) && (end_hrs > hrs))
  {total_time = ((end_min + 60) - min) + ((end_hrs - 1 - hrs) * 60);}
 else if ((end_min >= min) && (end_hrs >= hrs))
  {total_time = (end_min - min) + ((end_hrs - hrs) * 60);}
 else if ((end_min < min) && (end_hrs < hrs))
  {total_time = ((end_min + 60) - min) + (((end_hrs -1) - (hrs - 24)) * 60);}
 else if ((end_min > min) && (end_hrs < hrs))
  {total_time = (end_min - min) + ((end_hrs - (hrs -24)) * 60);}
 return total_time;
}

double Call_Cost(double total_cost)
{
 if ((hrs < 18) && (hrs>= 8) && (total_time >= 60))
  {
   sub_total = total_time * reg_rate;
   sub_total1 = sub_total - (sub_total * discount);
   tax = sub_total1 * tax_rate;
   total_cost = sub_total1 + tax;
  }
 else if ((hrs < 18) && (hrs >=8))
  {
   sub_total = total_time * reg_rate;
   tax = sub_total * tax_rate;
   total_cost = sub_total + tax;
  }
 else if ((hrs >= 18) && (total_time >=60))
  {
   sub_total = total_time * reg_rate;
   sub_total1 = sub_total - (sub_total * pm_discount);
   sub_total2 = sub_total1 - (sub_total1 * discount);
   tax = sub_total2 * tax_rate;
   total_cost = sub_total2 + tax;
  }
 else if ((hrs >= 18) || (hrs < 8))
  {
   sub_total = total_time * reg_rate;
   sub_total1 = sub_total - (sub_total * pm_discount);
   tax = sub_total1 * tax_rate;
   total_cost = sub_total1 + tax;
  }
 else if ((hrs < 8) && (total_time >= 60))
  {
   sub_total = total_time * reg_rate;
   sub_total1 = sub_total - (sub_total * pm_discount);
   sub_total2 = sub_total1 - (sub_total1 * discount);
   tax = sub_total2 * tax_rate;
   total_cost = sub_total2 + tax;
  }
 return total_cost;
}    

JdubAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
What do you need help with?
What it your program doing wrong?
Can you post your code so we can see where the problem is?
0
JdubAuthor Commented:
Edited text of question.
0
nil_dibCommented:
the problem are the two lines:

cost[10] = total_cost;

you declared cost as an array of 10(!!) doubles, but the line
cost[10] = total_cost;
accesses the 11 element of the array (to access the 10 element: cost[9] beginning with 0 until 9)!!!

feel free to ask if you need further information.

nil_dib
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.