i need pseudo code and flowchart of the following program
#include
#include
#include
void option1(){ //option to add a Vaccine record
struct Vaccine vc;
vc.initial = 1000000;
fflush(stdin);
printf("Enter Vaccine name: ");
fflush(stdin);
scanf("%s", &vc.vc_name);
printf("Enter Vaccine Code: ");
fflush(stdin);
scanf("%s", &vc.vc_code);
printf("Enter Vaccine Producing Country: ");
fflush(stdin);
scanf("%s", &vc.prod_country);
printf("Enter Dosage Required for the Vaccine: ");
scanf("%d", &vc.dos_req);
printf("Enter Population Covered with this Vaccine: ");
scanf("%f", &vc.pop_covered);
FILE *file;
file = fopen("vaccine.dat", "a");
fwrite(&vc, sizeof(vc), 1, file);
fclose(file);
}
void option2(){ //option to add or distribute amount
char v_code[3];
printf("Enter the particular Vaccine\'s code: ");
scanf("%s", &v_code);
FILE *file;
struct Vaccine vc;
file = fopen("vaccine.dat", "rb");
int flag = 1;
int pos = 0;
while(1){
fread(&vc, sizeof(vc), 1, file);
if(strcmp(vc.vc_code, v_code) == 0){
flag = 0;
printf("Vaccine found!\n1. Press '1' to add quantity.\n2. Press '2' to distribute quantity.");
int choice;
scanf("%d", &choice);
FILE *file2;
file2 = fopen("temp.dat", "wb");
int x;
fclose(file);
file = fopen("vaccine.dat", "rb");
struct Vaccine hold;
while(1){
if(feof(file)){
break;
}
fread(&vc, sizeof(vc), 1, file);
if(strcmp(vc.vc_code, v_code) != 0){
fwrite(&vc, sizeof(vc), 1, file2);
}else{
hold = vc;
}
}
long amount = 0;
if(choice == 1){
printf("Enter amount to add in stock: ");
scanf("%ld", &amount);
hold.initial += amount;
}else if(choice == 2){
printf("Enter amount to be distributed: ");
scanf("%Ld", &amount);
if(hold.initial - amount <>
printf("Current stock is not sufficient enough to proceed distribution!");
fclose(file);
fclose(file2);
remove("temp.dat");
break;
}else{
hold.initial -= amount;
printf("%ld", hold.initial);
FILE * dist;
dist = fopen("dist.dat", "a");
struct Vaccine_dist vc_dist;
strcpy(vc_dist.vc_code, v_code);
vc_dist.dist = amount;
fwrite(&vc_dist, sizeof(vc_dist), 1, dist);
fclose(dist);
}
}
fwrite(&hold, sizeof(hold), 1, file2);
fclose(file);
fclose(file2);
file2 = fopen("temp.dat", "rb");
file = fopen("vaccine.dat", "wb");
while(1){
if(feof(file2)){
break;
}
fread(&hold, sizeof(hold), 1, file2);
fwrite(&hold, sizeof(hold), 1, file);
}
printf("Record has been updated!");
fclose(file);
fclose(file2);
remove("temp.dat");
break;
}
if(feof(file)){
break;
}
}
if(flag){
printf("Vaccine not found!");
}
}
void option3(){ //option to search for a vaccine
printf("Enter Vaccine code: ");
char code[2];
scanf("%s", &code);
FILE *file;
file = fopen("vaccine.dat", "rb");
struct Vaccine vc;
int flag = 1;
while(1){
fread(&vc, sizeof(vc), 1, file);
if(strcmp(vc.vc_code, code) == 0){
flag = 0;
printf("Vaccine Name: %s\nAvailable Quantity: %ld", vc.vc_name, vc.initial);
break;
}
if(feof(file)){
break;
}
}
if(flag){
printf("Vaccine not found with such code!");
}
}
void option4(){ //option to get the sorted list of disrtributed vaccines
FILE *file;
file = fopen("dist.dat", "rb");
if(file == NULL){
printf("The record is empty!");
return;
}
struct Vaccine_dist vdist;
int num = 0;
long dists[100];
char codes[100][3];
int x;
long hold_dist;
int pos;
while(1){
if(feof(file)){
break;
}
fread(&vdist, sizeof(vdist), 1, file);
int flag = 1;
for(x = 0; x < num;="">
if(strcmp(vdist.vc_code, codes[x]) == 0){
flag = 0;
dists[x] += vdist.dist;
pos = x;
}
}
if(flag){
strcpy(codes[num], vdist.vc_code);
dists[num] = vdist.dist;
pos = num;
num++;
}
hold_dist = vdist.dist;
}
dists[pos] -= hold_dist;
int index[num];
for(x = 0; x < num;="">
index[x] = x;
}
bubbleSort(&index, &dists, num);
for(x = 0; x < num;="">
printf("%s\t%ld\n", codes[index[x]], dists[index[x]]);
}
}
void option5(){
printf("Exiting application...");
exit(0);
}