Question

Design flow chart of this code and make sure it is not handwritten it must on...

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;
}

Homework Answers

Answer #1

The flowchart ,which shows the execution flow of the program.

The flowchart of the program is as follows,

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Design flow chart on software not handwritten. void claimProcess() {    int id;    bool found...
Design flow chart on software not handwritten. void claimProcess() {    int id;    bool found = false;    system("cls");       printf("Enter user ID for which you want to claim insurrence: ");    scanf("%d", &id);    int i;    for (i = 0; i < userCount; i++)    {        if (users[i].id == id)        {            found = true;            break;        }    }    if (found == false)   ...
Explain this code function by function in detail int menu() {   int choice;   do {     system("cls");...
Explain this code function by function in detail 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; void subscribe() system("cls");   victims[userCount].id = userCount + 1;   printf("Enter age: ");   scanf("%d", &victims[userCount].age);   printf("\n\n%-25sHealth Insurence Plan\n\n", " ");   printf("-----------------------------------------------------------------------------------------------\n");   printf("|%-30s|%-20s|%-20s|%-20s|\n", " ", "Plan 120(RM)", "Plan 150(RM)", "Plan 200(RM)");   printf("-----------------------------------------------------------------------------------------------\n");   printf("|%-30s|%-20d|%-20d|%-20d|\n", "Monthly Premium", 120, 150, 200);   printf("|%-30s|%-20d|%-20d|%-20d|\n", "Annual Claim Limit", 120000,150000,200000);   printf("|%-30s|%-20d|%-20d|%-20d|\n",...
LANGUAGE C The codes below reads another .c or .txt file. Then, it will read the...
LANGUAGE C The codes below reads another .c or .txt file. Then, it will read the contents of every line and store the contents into a string array. Example: .c file that is to be read: #include <stdio.h> int main(){    printf("Hello World");    return ; } _______________(END OF THE FILE)_______________ Therefore, the code will read the contents above and store the contents in every line into an array, such that.... array[0] = "#include <stdio.h>\n" array[1] = "\n" array[2] ="int...
"C language" Take this code and make the minor modification necessary to create a circular linked...
"C language" Take this code and make the minor modification necessary to create a circular linked list (Hint: Store a pointer to the first node in the next pointer of the last node.) Demonstrate that this is working by traversing the list until the first pointer is encountered 3 times. Next redefine the node structure to include a back pointer. This will enable your program to move from front to back and then from back to front. It is not...
For the following code in C, I want a function that can find "america" from the...
For the following code in C, I want a function that can find "america" from the char array, and print "america is on the list" else "america is not on the list" (Is case sensitive). I also want a function to free the memory at the end of the program. #include <stdio.h> #include <stdlib.h> struct Node { void *data; struct Node *next; }; struct List { struct Node *head; }; static inline void initialize(struct List *list) { list->head = 0;...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the codes below. Requirement: Goals for This Project:  Using class to model Abstract Data Type  OOP-Data Encapsulation You are asked to write an app to keep track of a relatively small music library. The app should load song information from a data file once the app is started. It should allow user to view, add, remove, and search for songs. The app should...
It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions...
It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions are suggested for easier procedure of making function.) void search_node(struct linked_list* list, int find_node_ value) (The function to make) This function finds the node from the list that value is same with find_node_value and count the order of the node. This function should print message “The order of (node_value) is (order).” and error message “Function search_node : There is no such node to search.”....
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
currently the code contacts the server 1 time and exits. Modify the code so that the...
currently the code contacts the server 1 time and exits. Modify the code so that the program contacts the server five times before exiting. /* client.c - code for example client program that uses TCP */ #ifndef unix #define WIN32 #include <windows.h> #include <winsock.h> #else #define closesocket close #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #endif #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #define PROTOPORT 5193 /* default protocol port number */ extern int errno; char...