I am very new to programming...and Ihave a program using a goto statement..
however, I need to redo the program, using functions..
Can some body help please............??
My program is asfollows:
#include<stdio.h>
main(void)
{
int cust_id,counter;
float cur_bl,new_chgs,avail_crdt,crdt_lmt;
counter=0;
part1:
printf("Please Enter Customer ID or Enter 0 to terminate:\n");
scanf("%d",&cust_id);
while(cust_id!=0)
{
printf("Enter Current Balance:",cur_bl);
scanf("%f",&cur_bl);
printf("Enter New Charges:",new_chgs);
scanf("%f",&new_chgs);
printf("Enter Credit Limit:",crdt_lmt);
scanf("%f",&crdt_lmt);
cur_bl=cur_bl+new_chgs;
avail_crdt=crdt_lmt-cur_bl;
printf("For Customer ID:%d\n",cust_id);
printf("You now have a balance of :$%.2f\n",cur_bl);
printf("Your Credit Limit ïs:$%.2f",crdt_lmt);
if(avail_crdt>0)
printf("Your available credit limit is now:$%.2f\n",avail_crdt);
else
printf("YOu have reached your credit limit\n");
counter++;
goto part1;
}
printf("This program will now terminiate\n");
printf("The total number of customers processed:%d\n",counter);
return 0;
}
This program should update customers balance and also the credit limit.
Once I say 0 for customer ID, it should terminate the program .
Also, should tell me the number of customers processed.
Immediate help would help me a lot becasue i have to submit the assignment tonight.