
I need psuedo code and flowchart of the following program
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct vacc{
char vaccName[15];
char vaccCode[2];
char country[15];
int qty;
float population;
}v[10];
// Function Declarations
void create_inventory();
void update_vacc_qty();
int search_vaccine();
void display_vaccine();
// Main Function starts here
int main()
{
int ch;
do {
printf("\n 1:create inventory");
printf("\n 2: display vaccine info ");
printf("\n 3: search vaccine");
printf("\n enter your choice (0 to exit):");
scanf("%d",&ch);
switch (ch)
{
case 1: create_inventory();
break;
case 2: display_vaccine();
break;
case 3: search_vaccine();
break;
default : break;
}
}while(ch!=0);
return 0;
}
//Function to Create Dist.txt as per the given table
void create_inventory()
{
int option = 1;
// variables to collect data as per table given
char vaccName[15];
char vaccCode[2];
char country[15];
int qty;
float populaion;
//File definition
FILE *infile;
infile = fopen("dist.txt","w"); // file opening for writing
if(infile == NULL) // Checking for the file creation
{
printf("dist.txt file not found\n");
}
//Accepting data from user from keyboard till user enters 0 to close
while(option != 0)
{
printf("Enter Vaccine Name : ");
scanf("%s",vaccName);
printf("Enter Vaccine Code : ");
scanf("%s",vaccCode);
printf("Enter Counry : ");
scanf("%s",country);
printf("Enter Dosage Required : ");
scanf("%d",&qty);
printf("Enter Population Covered : ");
scanf("%f",&populaion);
//writing to the file using fprintf command
fprintf(infile,"%s %s %s %d %3.2f\n", vaccName,vaccCode,country,qty,populaion);
printf("\nEnter 1 to continue and 0 to exit : ");
scanf("%d",&option);
if(option == 0)
fclose(infile); // closing the file when user wants to exit
}
}
//Function to display the file contents in a formatted way
void display_vaccine()
{
// variables to collect data as per table given
char vaccName[15];
char vaccCode[2];
char country[15];
int qty;
float populaion;
FILE *infile;
infile = fopen("Vaccine.txt","r"); // file opening for reading
if(infile == NULL) //checking for file exists or not
{
printf("Vaccine.txt file not found\n");
}
//printing the header line
printf("%15s\t%2s\t%15s\t%6s\t%10s\n","Vaccine Name","Vaccine Code","Country","Dosage","Population");
// Reading the file
while(fscanf(infile,"%s %s %s %d %f\n",vaccName,vaccCode,country,&qty,&populaion) !=EOF)
{
//printing the read data in a formatted way
printf("%15s\t%13s\t%15s\t%d\t%3.2f\n",vaccName,vaccCode,country,qty,populaion);
}
fclose(infile); // closing the file
}
void update_vacc_qty()
{
int t, option;
char vaccName[15];
char vaccCode[2];
char country[15];
int qty;
float population;
//File definition
FILE *infile;
//Accepting data from user from keyboard till user enters 0 to close
while(option != 0)
{
printf("Enter Vaccine Name : ");
scanf("%s",vaccName);
printf("Enter Vaccine Code : ");
scanf("%s",vaccCode);
printf("Enter Counry : ");
scanf("%s",country);
printf("Enter Dosage Required : ");
scanf("%d",&qty);
printf("Enter Population Covered : ");
scanf("%f",&population);
//writing to the file using fprintf command
fprintf(infile,"%s %s %s %d %3.2f\n", vaccName,vaccCode,country,qty,population);
printf("\nEnter 1 to continue and 0 to exit : ");
scanf("%d",&option);
if(option == 0)
fclose(infile); // closing the file when user wants to exit
}
//struct vacc v[10];
{
printf("dist.txt file not found\n");
}
// Reading the file
t=0;
while(fscanf(infile,"%s %s %s %d %f\n",vaccName,vaccCode,country,&qty,&population) !=EOF)
{
//printf("%s",vaccName);
strcpy(v[t].vaccName,vaccName);
strcpy(v[t].vaccCode,vaccCode);
strcpy(v[t].country,country);
v[t].qty=qty;
v[t].population=population;
t++;
}
struct vacc temp;
for (int i = 0; i < t - 1; i++)
{
for (int j = 0; j < (t - 1-i); j++)
{
if (v[j].qty < v[j + 1].qty)
{
temp = v[j];
v[j] = v[j + 1];
v[j + 1] = temp;
}
}
}
//printing the header line
printf("%15s\t%2s\t%15s\t%6s\t%10s\n","Vaccine Name","Vaccine Code","Country","Dosage","Population");
for(int i=0;i<t; i++){
printf("%15s\t%13s\t%15s\t%d\t%3.2f\n",v[i].vaccName,v[i].vaccCode,v[i].country,v[i].qty,v[i].population);
}
fclose(infile); // closing the file
}
int search_vaccine()
{
// variables to collect data as per table given
char vaccName[15];
char vaccCode[2];
char country[15];
int qty;
float populaion;
FILE *infile;
char vcode[2];
char temp[2];
int value;
infile = fopen("Vaccine.txt","r"); // file opening for reading
//getting the vaccine code from user through keyboard to search
printf("Enter Vaccine Code to Search : ");
scanf("%s",vcode);
if(infile == NULL) // checking for file existence
{
printf("Vaccine.txt file not found\n");
}
strcpy(temp,vcode);
//Reading the file
while(fscanf(infile,"%s %s %s %d %f\n",vaccName,vaccCode,country,&qty,&populaion) !=EOF)
{
//checking user entered vaccine code and available in the file is same
if(vaccCode[0] == temp[0] && vaccCode[1] == temp[1])
{
// Printing the matched record
printf("%15s\t%2s\t%15s\t%6s\t%10s\n","Vaccine Name"," Vaccine Code","Country","Dosage","Population");
printf("%15s\t%13s\t%15s\t%d\t%3.2f\n",vaccName,vaccCode,country,qty,populaion);
}
}
fclose(infile);// closing the file
}//end of Program

Step by stepSolved in 2 steps

- typedef _people { int age; char name[ 32 ] ; } People_T ; People_T data [ 3 ]; Using string lib function, Assign 30 and Cathy to the first cell, Assign 40 and John to the second cell and Assign 50 and Tom to the third cell People_T *ptr ; Declare a pointer pointing to the structure data and print the age and name using the pointer. your output can be : 30 Cathy 40 John 50 Tomarrow_forwardComplete the C++ code below#include "std_lib_facilities.h"/*1. Define a function which calculates the outer product of two vectors. The function return is a matrix. */vector<vector<int>> outerProduct(vector<int>& A, vector<int>& B){//implement here}/*2. Define a function which transposes a matrix. */vector<vector<int>> transpose(vector<vector<int>>& A){//implementation}/*3. Define a function which calculates the multiplication of a matrix and it's transpose. */vector<vector<int>> product(vector<vector<int>>& A){// implementation}/*4. Define a print out function that will print out a matrix in the following format:Example: a 3 by 4 matrix should have the print out:1 2 3 42 3 4 53 4 5 6*/void printMatrix(vector<vector<int>>& A){// implementation}int main(){// Define both vector A and vector Bvector<int> A = {1 ,2, 3, 4, 5};vector<int> B = {1, 2, 3};/*Test outerProduct…arrow_forwarduse c++ Programming language Write a program that creates a two dimensional array initialized with test data. Use any data type you wish . The program should have following functions: .getAverage: This function should accept a two dimensional array as its argument and return the average of each row (each student have their average) and each column (class test average) all the values in the array. .getRowTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row. .getColumnTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column. .getHighestInRow: This function should accept a two…arrow_forward
- i want header file of this code #include <stdio.h>#include <stdlib.h>#include <string.h> struct vacc{char vaccName[15]; char vaccCode[2]; char country[15]; int qty; float population; }v[10]; // Function Declarations void create_inventory(); void update_vacc_qty(); int search_vaccine(); void display_vaccine(); // Main Function starts here int main() { int ch;do {printf("\n 1:create inventory");printf("\n 2: display vaccine info ");printf("\n 3: search vaccine");printf("\n enter your choice (0 to exit):");scanf("%d",&ch); switch (ch){case 1: create_inventory();break;case 2: display_vaccine();break;case 3: search_vaccine();break;default : break;} }while(ch!=0);return 0; } //Function to Create Vaccine.txt as per the given table void create_inventory() { int option = 1; // variables to collect data as per table given char vaccName[15]; char vaccCode[2]; char country[15]; int qty; float populaion; //File definition FILE *infile; infile = fopen("dist.txt","w"); // file…arrow_forward3. Assume you have the following structure definition: struct parts { string name; int num; float price; int qInStock; }; a. Write a program that declares an array of the parts structure, size 10, name of your choice, and includes the following: Write a void function to request user input into each of the component members of the parts structure array. Be sure to include proper user prompts. Assume the entire structure array is filled. Write the prototype and the function definition. Call the function from main.Write a void function to output the information in the parts structure array. Write the prototype and the function definition. Call the function from main.arrow_forwardhelp me solve this in c++ please Write a program that asks the user to enter a list of numbers from 1 to 9 in random order, creates and displays the corresponding 3 by 3 square, and determines whether the resulting square is a Lo Shu Magic Square. Notes Create the square by filling the numbers entered from left to right, top to bottom. Input validation - Do not accept numbers outside the range. Do not accept repeats. Must use two-dimensional arrays in the implementation. Functional decomposition — Program should rely on functions that are consistent with the algorithm.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





