Design flow chart of this code and make sure it is not handwritten it must on some software.
struct user {
int id;
int age;
bool annualClaim;
int plan;
char name[30];
char contactNum[15];
char address[50];
};
#define MAX_LENGTH 500
struct user users[100];
int userCount = 0;
struct claim {
int id;
int claimedYear;
int amountClaimed;
int remaininigAmount;
};
struct claim claims[100];
void loadData()
{
char line[MAX_LENGTH];
const char *delimiter = ",\n";
FILE *fp;
fp = fopen("users.txt", "r");
char c;
if (fp == NULL)
{
printf("file not found");
return;
}
while (fp != NULL)
{
if (fgets(line, MAX_LENGTH - 1, fp)
== NULL)
break;
if (line[1] == '\0')
break;
users[userCount].id =
atoi(strtok(line, delimiter));
strcpy(users[userCount].name,strtok(NULL, delimiter));
users[userCount].age =
atoi(strtok(NULL, delimiter));
users[userCount].annualClaim =
strtok(NULL, delimiter);
users[userCount].plan =
atoi(strtok(NULL, delimiter));
strcpy(users[userCount].contactNum,
strtok(NULL, delimiter));
strcpy(users[userCount].address,
strtok(NULL, delimiter));
strcpy(line, "\0");
userCount++;
}
fclose(fp);
fp = fopen("claims.txt", "r");
int claimCount = 0;
while (fp != NULL)
{
if (fgets(line, MAX_LENGTH - 1, fp)
== NULL)
break;
if (line == "\n")
break;
claims[claimCount].id =
atoi(strtok(line, delimiter));
claims[claimCount].claimedYear =
atoi(strtok(NULL, delimiter));
claims[claimCount].amountClaimed =
atoi(strtok(NULL, delimiter));
claims[claimCount].remaininigAmount
= atoi(strtok(NULL, delimiter));
strcpy(line, "\0");
claimCount++;
}
fclose(fp);
}
int menu()
{
int choice;
do {
system("cls");
printf("1-Insurence Plan
Subscription\n");
printf("2-Claim
Processing\n");
printf("3-Accounts
Information\n");
printf("4-Searching
Functionalities\n");
printf("5-Exit\n");
scanf("%d", &choice);
} while (choice > 5 || choice < 1);
return choice;
}
The flowchart ,which shows the execution flow of the program.
The flowchart of the program is as follows,
Get Answers For Free
Most questions answered within 1 hours.