can you solve this problem in this code, Microsoft Visual Studio 2019 can't run: #include #include #include void create_inventory(); void update_vacc_qty(); int search_vaccine(); void display_vaccine();   int main() { create_inventory(); display_vaccine(); search_vaccine(); return 0; } void create_inventory() { int option = 1; char vaccinename[15]; char vaccinecode[2]; char country[15]; int dosage; float populaion; FILE* infile; infile = fopen("Vaccine.txt","w"); if (infile == NULL) { printf("Vaccine.txt file unfamiliar\n"); } while (option != 0) { printf("Enter Vaccine Name : "); scanf("%s", vaccinename); printf("Enter Vaccine Code : "); scanf("%s", vaccinecode); printf("Enter Counry Name : "); scanf("%s", country); printf("Enter Dosage Required : "); scanf("%d", &dosage); printf("Enter Population Covered : "); scanf("%f", &populaion); fprintf(infile, "%s %s %s %d %3.2f\n",vaccinename, vaccinecode, country, dosage, populaion); printf("\n press 1 to pursue and 0 to exit : "); scanf("%d", &option); if (option == 0) fclose(infile); } } void display_vaccine() { char vaccinename[15]; char vaccinecode[2]; char country[15]; int dosage; float populaion; FILE* infile; infile = fopen("Vaccine.txt", "r"); if (infile == NULL) { printf("Vaccine.txt file unfamiliar\n"); } printf("%15s\t%2s\t%15s\t%6s\t%10s\n", "Vaccine Name", "Vaccine Code", "Country", "Dosage", "Population"); while (fscanf(infile, "%s %s %s %d %f\n", vaccinename, vaccinecode, country, &dosage, &populaion) != EOF) { printf("%15s\t%13s\t%15s\t%d\t%3.2f\n", vaccinename, vaccinecode, country, dosage, populaion); } fclose(infile); } int search_vaccine() { char vaccinename[15]; char vaccinecode[2]; char country[15]; int dosage; float populaion; FILE* infile; char vcode[2]; char temp[2]; int value; infile = fopen("Vaccine.txt", "r"); printf("Enter Vaccine Code to explore : "); scanf("%s", vcode); if (infile == NULL) { printf("Vaccine.txt file unfamiliar\n"); } strcpy(temp, vcode); while (fscanf(infile, "%s %s %s %d %f\n", vaccinename, vaccinecode, country, &dosage, &populaion) != EOF) { if (vaccinecode[0] == temp[0] && vaccinecode[1] == temp[1]) { 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", vaccinename, vaccinecode, country, dosage, populaion); } } fclose(infile); }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

can you solve this problem in this code, Microsoft Visual Studio 2019 can't run:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


void create_inventory();
void update_vacc_qty();
int search_vaccine();
void display_vaccine();

 

int main()
{
create_inventory();
display_vaccine();
search_vaccine();

return 0;
}


void create_inventory()
{
int option = 1;

char vaccinename[15];
char vaccinecode[2];
char country[15];
int dosage;
float populaion;


FILE* infile;
infile = fopen("Vaccine.txt","w");
if (infile == NULL)
{
printf("Vaccine.txt file unfamiliar\n");
}


while (option != 0)
{
printf("Enter Vaccine Name : ");
scanf("%s", vaccinename);
printf("Enter Vaccine Code : ");
scanf("%s", vaccinecode);
printf("Enter Counry Name : ");
scanf("%s", country);
printf("Enter Dosage Required : ");
scanf("%d", &dosage);
printf("Enter Population Covered : ");
scanf("%f", &populaion);

fprintf(infile, "%s %s %s %d %3.2f\n",vaccinename, vaccinecode, country, dosage, populaion);
printf("\n press 1 to pursue and 0 to exit : ");
scanf("%d", &option);
if (option == 0)
fclose(infile);
}
}

void display_vaccine()
{

char vaccinename[15];
char vaccinecode[2];
char country[15];
int dosage;
float populaion;
FILE* infile;
infile = fopen("Vaccine.txt", "r");
if (infile == NULL)
{
printf("Vaccine.txt file unfamiliar\n");
}

printf("%15s\t%2s\t%15s\t%6s\t%10s\n", "Vaccine Name", "Vaccine Code", "Country", "Dosage", "Population");

while (fscanf(infile, "%s %s %s %d %f\n", vaccinename, vaccinecode, country, &dosage, &populaion) != EOF)
{

printf("%15s\t%13s\t%15s\t%d\t%3.2f\n", vaccinename, vaccinecode, country, dosage, populaion);
}
fclose(infile);
}

int search_vaccine()
{

char vaccinename[15];
char vaccinecode[2];
char country[15];
int dosage;
float populaion;
FILE* infile;
char vcode[2];
char temp[2];
int value;
infile = fopen("Vaccine.txt", "r");

printf("Enter Vaccine Code to explore : ");
scanf("%s", vcode);
if (infile == NULL)
{
printf("Vaccine.txt file unfamiliar\n");
}
strcpy(temp, vcode);

while (fscanf(infile, "%s %s %s %d %f\n", vaccinename, vaccinecode, country, &dosage, &populaion) != EOF)
{

if (vaccinecode[0] == temp[0] && vaccinecode[1] == temp[1])
{

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", vaccinename, vaccinecode, country, dosage, populaion);
}
}
fclose(infile);
}

A C6031
A C6031
A C6031
A C6031
A C6031
DA C6387
Return value ignored: 'scanf'.
Project1
SOURCE.CPP
45
Return value ignored: 'scanf'.
Project1
SOURCE.CPP
47
Return value ignored: 'scanf.
Project1
SOURCE.CPP
49
Return value ignored: 'scanf'.
Project1
SOURCE.CPP
51
Return value ignored: 'scanf'.
Project1
SOURCE.CPP
53
'infile' could be '0': this does not adhere to the specification for the function 'fprintf'.
Project1
SOURCE.CPP
55
A C6031
Return value ignored: 'scanf'.
Project1
SOURCE.CPP
57
DA C6387
'infile' could be 'O': this does not adhere to the specification for the function 'fscanf'.
Project1
SOURCE.CPP
80
'infile' could be 'O': this does not adhere to the specification for the function 'fclose'. See line 80 for an
DA C6387
Project1
SOURCE.CPP
85
earlier location where this can occur
A C6031
Return value ignored: 'scanf'.
Project1
SOURCE.CPP
103
DA C6054
String 'vcode' might not be zero-terminated.
Project1
SOURCE.CPP
108
D A C6387
'infile' could be 'O': this does not adhere to the specification for the function 'fscanf'.
Project1
SOURCE.CPP
110
'infile' could be '0': this does not adhere to the specification for the function 'fclose'. See line 110 for an
P A C6387
Project1
SOURCE.CPP
120
earlier location where this can occur
'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation,
use_CRT_SECURE_NO_WARNINGS. See online help for details.
* C4996
Project1
Source.cpp
35
'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use roiecti
_CRT_SECURE_NO_WARNINGS. See online help for details.
C4996
Source.cpp
45
* C4996
'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use preiarti
CRT SECURE_No WARNINGS. See online help for details.
Source.cpp
47
'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use preiect1
CRT SECURE_NO WARNINGS. See online help for details.
'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
O C4996
Project1
Source.cpp
49
* C4996
Source.cpp
51
X C4996
Project1
Source.cpp
53
X C4996
Project1
Source.cpp
57
'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation,
use CRT_SECURE_NO_WARNINGS. See online help for details.
'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, Project1
C4996
Project1
Source.cpp
72
* C4996
Source.cpp
80
use CRT_SECURE_NO_WARNINGS. See online help for details.
'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, Droiecti
use CRT SECURE_NO_WARNINGS. See online help for details.
'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use peiarti
_CRT_SECURE_NO_WARNINGS. See online help for details.
O C4996
Source.cpp
100
* C4996
Source.cpp
103
'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, Dreiecti
use_CRT_SECURE_NO_WARNINGS. See online help for details.
'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, Duria
use CRT_SECURE_NO_WARNINGS. See online help for details.
O C4996
Source.cpp
108
X C4996
Source.cpp
110
A C4101
'value': unreferenced local variable
Project1
Source.cpp
99
Transcribed Image Text:A C6031 A C6031 A C6031 A C6031 A C6031 DA C6387 Return value ignored: 'scanf'. Project1 SOURCE.CPP 45 Return value ignored: 'scanf'. Project1 SOURCE.CPP 47 Return value ignored: 'scanf. Project1 SOURCE.CPP 49 Return value ignored: 'scanf'. Project1 SOURCE.CPP 51 Return value ignored: 'scanf'. Project1 SOURCE.CPP 53 'infile' could be '0': this does not adhere to the specification for the function 'fprintf'. Project1 SOURCE.CPP 55 A C6031 Return value ignored: 'scanf'. Project1 SOURCE.CPP 57 DA C6387 'infile' could be 'O': this does not adhere to the specification for the function 'fscanf'. Project1 SOURCE.CPP 80 'infile' could be 'O': this does not adhere to the specification for the function 'fclose'. See line 80 for an DA C6387 Project1 SOURCE.CPP 85 earlier location where this can occur A C6031 Return value ignored: 'scanf'. Project1 SOURCE.CPP 103 DA C6054 String 'vcode' might not be zero-terminated. Project1 SOURCE.CPP 108 D A C6387 'infile' could be 'O': this does not adhere to the specification for the function 'fscanf'. Project1 SOURCE.CPP 110 'infile' could be '0': this does not adhere to the specification for the function 'fclose'. See line 110 for an P A C6387 Project1 SOURCE.CPP 120 earlier location where this can occur 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use_CRT_SECURE_NO_WARNINGS. See online help for details. * C4996 Project1 Source.cpp 35 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use roiecti _CRT_SECURE_NO_WARNINGS. See online help for details. C4996 Source.cpp 45 * C4996 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use preiarti CRT SECURE_No WARNINGS. See online help for details. Source.cpp 47 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use preiect1 CRT SECURE_NO WARNINGS. See online help for details. 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. O C4996 Project1 Source.cpp 49 * C4996 Source.cpp 51 X C4996 Project1 Source.cpp 53 X C4996 Project1 Source.cpp 57 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use CRT_SECURE_NO_WARNINGS. See online help for details. 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, Project1 C4996 Project1 Source.cpp 72 * C4996 Source.cpp 80 use CRT_SECURE_NO_WARNINGS. See online help for details. 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, Droiecti use CRT SECURE_NO_WARNINGS. See online help for details. 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use peiarti _CRT_SECURE_NO_WARNINGS. See online help for details. O C4996 Source.cpp 100 * C4996 Source.cpp 103 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, Dreiecti use_CRT_SECURE_NO_WARNINGS. See online help for details. 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, Duria use CRT_SECURE_NO_WARNINGS. See online help for details. O C4996 Source.cpp 108 X C4996 Source.cpp 110 A C4101 'value': unreferenced local variable Project1 Source.cpp 99
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY