#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
FILE *fptr;
char ans;
char buff[100];
char name[200];
char address[500];
char telephone[17];
char sex[23];
char dateOfBirth[100];
unsigned char jobDescription[2000000];
float amountOfMoney,discount,d_price;
int x,y;
time_t now = time(0);
for(x = 1; x<=1000;x++){
printf("\nENTER ALL CUSTOMER INFORMATION BELOW.\n");
fptr = fopen("C:\Customer's Info.txt", "a+");
printf("\n\nPlease Enter the Customer's Name: ");
fflush(stdin);
scanf(" %[^\n]", &name);
fprintf(fptr,"Customer Number: %i\n",x);
fprintf(fptr,"Customer Name: %s\n",name);
printf("\nPlease Enter Customer's Gender: ");
fflush(stdin);
scanf("%[^\n]",&sex);
fprintf(fptr,"Customer Gender: %s\n",sex);
printf("\nPlease Enter Customer's Date Of Birth: ");
fflush(stdin);
scanf("%[^\n]",&dateOfBirth);
fprintf(fptr,"Customer D.O.B: %s\n",dateOfBirth);
printf("\nPlease Enter Customer's Current Address: ");
fflush(stdin);
scanf("%[^\n]",&address);
fprintf(fptr,"Customer Address: %s\n",address);
printf("\nPlease Enter Customer's Telephone Number: ");
fflush(stdin);
scanf("%[^\n]",&telephone);
fprintf(fptr,"Customer PhoneNumber: %s\n",telephone);
printf("\nPlease Enter The Customer's Job Description: ");
fflush(stdin);
scanf("%[^\n]",jobDescription);
fprintf(fptr,"Customer Complaint: %s\n",jobDescription);
printf("\nPlease Enter The Amount The Customer Paid: ");
fflush(stdin);
scanf("%f",&amountOfMoney);
fprintf(fptr,"Money Paid By Customer: $%.2f\n",amountOfMoney);
printf("\nIs %s Getting Any Discount? ",name);
fflush(stdin);
scanf(" %c",&ans);
if(ans == 'y'|| ans == 'Y'){
printf("\nEnter the Discount off in percentage (dont use %% just enter the digits): ");
fflush(stdin);
scanf("%f",&discount);
d_price = amountOfMoney - (discount/100.00 * amountOfMoney);
fprintf(fptr,"Customer Discount: %.2f%% off \nDiscounted
Price: $%.2f \n", discount, d_price);
}else{
printf("\n");
};
strftime(buff,100,"%Y-%m-%d %H:%M:%S.000", localtime(&now));
fprintf(fptr,"TimeStamp: %s\n\n\n",buff);
fclose(fptr);
}
getchar();
return 0;
}