SlideShare a Scribd company logo
1 of 7
// Reminder that your file name is incredibly important. Please do not change it.
// Reminder that we are compiling on Gradescope using GCC.
// READ BEFORE YOU START:
// You are given a partially completed program that creates a list of game items
like you'd see in a folder.
// Each item has this information: item's name, game's name, type of item, item ID.
// The struct 'itemRecord' holds information of one item. Variety is an enum.
// An array of structs called 'list' is made to hold the list of items.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the
directions carefully.
// You should not modify any of the given code, the return types, or the
parameters. Otherwise, you risk getting compilation errors.
// You are not allowed to modify main().
// You can use string library functions.
// WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma warning(disable: 4996) // for Visual Studio
Only
#define MAX_ITEMS 15
#define MAX_NAME_LENGTH 25
typedef enum { Health = 0, Equip, Etc } itemType; // enum type
struct itemRecord { // struct for item details
char itemName[MAX_NAME_LENGTH];
char gameName[MAX_NAME_LENGTH];
itemType variety;
unsigned int itemID;
};
struct itemRecord list[MAX_ITEMS]; // declare list of items
int count = 0; // the number of items
currently stored in the list (initialized to 0)
// functions already implmented
void flushStdIn();
void executeAction(char);
void save(char* fileName);
void display();
// functions that need implementation:
int add(char* itemName_input,
char* gameName_input,
char* variety_input,
unsigned int idNumber_input); // 10 points
void sort(); // 10 points
int delete(unsigned int idNumber_input); // 10 points
void load(char* fileName); // 10 points
int main()
{
char* fileName = "Item_List.txt";
load(fileName); // load list of items from
file (if it exists). Initially there will be no file.
char choice = 'i'; // initialized to a dummy
value
do
{
printf("nEnter your selection:n");
printf("t a: add a new itemn");
printf("t d: display item listn");
printf("t r: remove an item from listn");
printf("t s: sort item list by IDn");
printf("t q: quitn");
choice = getchar();
flushStdIn();
executeAction(choice);
} while (choice != 'q');
save(fileName); // save list of items to file
(overwrites file, if it exists)
return 0;
}
// flush out leftover 'n' characters
void flushStdIn()
{
char c;
do c = getchar();
while (c != 'n' && c != EOF);
}
// ask for details from user for the given selection and perform that action
void executeAction(char c)
{
char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH];
unsigned int idNumber_input, add_result = 0;
char variety_input[20];
switch (c)
{
case 'a':
// input item record from user
printf("nEnter item name: ");
fgets(itemName_input, sizeof(itemName_input), stdin);
itemName_input[strlen(itemName_input) - 1] = '0';
// discard the trailing 'n' char
printf("Enter game name: ");
fgets(gameName_input, sizeof(gameName_input), stdin);
gameName_input[strlen(gameName_input) - 1] = '0';
// discard the trailing 'n' char
printf("Enter whether item is a 'Health' or 'Equip' or 'Etc' item: ");
fgets(variety_input, sizeof(variety_input), stdin);
variety_input[strlen(variety_input) - 1] = '0';
// discard the trailing 'n' char
printf("Please enter item ID number: ");
scanf("%d", &idNumber_input);
flushStdIn();
// add the item to the list
add_result = add(itemName_input, gameName_input, variety_input,
idNumber_input);
if (add_result == 0)
printf("nItem is already on the list! nn");
else if (add_result == 1)
printf("nItem successfully added to the list! nn");
else
printf("nUnable to add. Item list is full! nn");
break;
case 'r':
printf("Please enter ID number of item to be deleted: ");
scanf("%d", &idNumber_input);
flushStdIn();
int delete_result = delete(idNumber_input);
if (delete_result == 0)
printf("nItem not found in the list! nn");
else
printf("nItem deleted successfully! nn");
break;
case 'd': display(); break;
case 's': sort(); break;
case 'q': break;
default: printf("%c is invalid input!n", c);
}
}
// This function displays the employee list with the details (struct elements) of
each employee.
void display()
{
char* varietyString = "Health"; //
dummy init
for (int i = 0; i < count; i++) //
iterate through the list
{
printf("nItem name: %s", list[i].itemName); //
display item's name
printf("nGame name: %s", list[i].gameName); //
display game's name
if (list[i].variety == Health) //
find what to display for item type
varietyString = "Health";
else if (list[i].variety == Equip)
varietyString = "Equip";
else
varietyString = "Etc";
printf("nItem Type: %s", varietyString); // display
item type
printf("nID Number: %d", list[i].itemID); //
display item's ID
printf("n");
}
}
// save() is called at the end of main()
// This function saves the array of structures to file. It is already implemented.
// You should read and understand how this code works. It will help you with
'load()' function.
// save() is called at end of main() to save the item list to a file.
// The file is saved at the same place as your C file.
// You can simply delete the file to 'reset the list' or to avoid loading from it.
void save(char* fileName)
{
FILE* file;
int i, varietyValue = 0;
file = fopen(fileName, "wb"); // open file for writing
fwrite(&count, sizeof(count), 1, file); // First, store the number of
employees in the list
// Parse the list and write employee record to file
for (i = 0; i < count; i++)
{
fwrite(list[i].itemName, sizeof(list[i].itemName), 1, file);
fwrite(list[i].gameName, sizeof(list[i].gameName), 1, file);
// convert enum to a number for storing
if (list[i].variety == Health)
varietyValue = 0; // 0 for HR
else if (list[i].variety == Equip)
varietyValue = 1; // 1 for Marketing
else
varietyValue = 2; // 2 for ITs
fwrite(&varietyValue, sizeof(varietyValue), 1, file);
fwrite(&list[i].itemID, sizeof(list[i].itemID), 1, file);
}
fclose(file); // close the file after writing
}
// Q1 : add (10 points)
// This function is used to add an item into the list. You can simply add the new
item to the end of list (array of structs).
// Do not allow the item to be added to the list if it already exists in the list.
You can do that by checking item names OR IDs already in the list.
// If the item already exists then return 0 without adding it to the list. If the
item does not exist in the list, then add the item at the end of the list and
return 1.
// If the item list is full, then do not add new item to the list and return 2.
// NOTE: Notice how return type of add() is checked in case 'a' of the
executeAction() function.
// NOTE: You must convert the string 'variety_input' to an enum type and store it
in the list because the item type has enum type (not string type).
// The list should be case sensitive. For instance, 'Mega Death Sword' and 'mega
death sword' should be considered two different names.
// Hint: the global variable 'count' holds the number of items currently in the
list
int add(char* itemName_input, char* gameName_input, char* variety_input, unsigned
int idNumber_input)
{
itemType item_enum;
// Write the code below.
return 0; // edit this
line as needed
}
// Q2 : sort (10 points)
// This function is used to sort the list (array of structs) numerically by the
item's ID.
// Parse the list and compare the item IDs to check which one should appear before
the other in the list.
// Sorting should happen within the list. That is, you should not create a new list
of structs having sorted items.
// Hint: Use a temp struct (already declared) if you need to swap two structs in
your logic
void sort()
{
struct itemRecord itemTemp; //
needed for swapping structs. Not absolutely necessary to use.
// Write the code below.
// display message for user to check the result of sorting. Do not touch this
printf("nItem list sorted! Use display option 'd' to view sorted list.n");
}
// Q3 : delete (10 points)
// This function is used to delete an item by ID.
// Parse the list and compare the item IDs to check which one should be deleted.
// Restore the array structure after removal of the item record.
// Return 0 if the specified ID was not found. Return 1 upon successful removal of
a record.
int delete(unsigned int idNumber_input)
{
struct itemRecord itemTemp; //
useful for swapping structs. Not absolutely necessary to use.
// Write the code below
return 0; // edit this line as needed
}
// Q4: load (10 points)
// This function is called in the beginning of main().
// This function reads the item list from the saved file and builds the array of
structures 'list'.
// In the first run of the program, there will be no saved file because save() is
called at the end of program.
// So at the begining of this function, write code to open the file and check if it
exists. If file does not exist, then return from the function.
// (See expected output of add() in homework question file. It displays
"Item_List.txt not found" because the file did not exist initially.)
// If the file exists, then parse the item list to read the employee details from
the file.
// Use the save function given above as an example of how to write this function.
Notice the order in which the struct elements are saved in save()
// You need to use the same order to read the list back.
// NOTE: The saved file is not exactly readable because all elements of the struct
are not string or char type.
// So you need to implement load() similar to how save() is implemented. Only
then the 'list' will be loaded correctly.
// You can simply delete the file to 'reset the list' or to avoid loading from
it.
void load(char* fileName)
{
// Write the code below.
// The following two print statements are used in your code. You can change
their position but not their contents.
printf("%s not found.n", fileName);
printf("Item record loaded from %s.n", fileName);
}
-- Reminder that your file name is incredibly important- Please do not.docx

More Related Content

Similar to -- Reminder that your file name is incredibly important- Please do not.docx

This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfinfo334223
 
Complete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdfComplete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdfrajkumarm401
 
a) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdfa) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdfMAYANKBANSAL1981
 
C++ detyrat postim_slideshare
C++ detyrat postim_slideshareC++ detyrat postim_slideshare
C++ detyrat postim_slidesharetctal
 
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docxajoy21
 
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docx
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docxRightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docx
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docxjoellemurphey
 
Write a program to find the number of comparisons using the binary se.docx
 Write a program to find the number of comparisons using the binary se.docx Write a program to find the number of comparisons using the binary se.docx
Write a program to find the number of comparisons using the binary se.docxajoy21
 
IN C LANGUAGE- I've been trying to finish this program for the last fe.docx
IN C LANGUAGE- I've been trying to finish this program for the last fe.docxIN C LANGUAGE- I've been trying to finish this program for the last fe.docx
IN C LANGUAGE- I've been trying to finish this program for the last fe.docxGordonpACKellyb
 
(Unordered Sets) As explained in this chapter, a set is a collection.pdf
(Unordered Sets) As explained in this chapter, a set is a collection.pdf(Unordered Sets) As explained in this chapter, a set is a collection.pdf
(Unordered Sets) As explained in this chapter, a set is a collection.pdfssuserc77a341
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdffantoosh1
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfcallawaycorb73779
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfmayorothenguyenhob69
 
import java.util.; public class IteratorDemo {public static voi.pdf
import java.util.; public class IteratorDemo {public static voi.pdfimport java.util.; public class IteratorDemo {public static voi.pdf
import java.util.; public class IteratorDemo {public static voi.pdfanilgoelslg
 
This class maintains a list of 4 integers. This list .docx
 This class maintains a list of 4 integers.   This list .docx This class maintains a list of 4 integers.   This list .docx
This class maintains a list of 4 integers. This list .docxKomlin1
 
#include fstream#include iostream#include cstdlib#includ.docx
#include fstream#include iostream#include cstdlib#includ.docx#include fstream#include iostream#include cstdlib#includ.docx
#include fstream#include iostream#include cstdlib#includ.docxajoy21
 
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
All code should be in C++Using the UnsortedList class (UnsortedLis.pdfAll code should be in C++Using the UnsortedList class (UnsortedLis.pdf
All code should be in C++Using the UnsortedList class (UnsortedLis.pdfakashenterprises93
 
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdfPLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdfmallik3000
 
READ BEFORE YOU START Please read the given Word document fo.pdf
READ BEFORE YOU START  Please read the given Word document fo.pdfREAD BEFORE YOU START  Please read the given Word document fo.pdf
READ BEFORE YOU START Please read the given Word document fo.pdfinfo673628
 

Similar to -- Reminder that your file name is incredibly important- Please do not.docx (20)

This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdf
 
Complete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdfComplete the provided partial C++ Linked List program. Main.cpp is g.pdf
Complete the provided partial C++ Linked List program. Main.cpp is g.pdf
 
a) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdfa) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdf
 
C++ detyrat postim_slideshare
C++ detyrat postim_slideshareC++ detyrat postim_slideshare
C++ detyrat postim_slideshare
 
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
#ifndef MYLIST_H_ #define MYLIST_H_#includeiostream #include.docx
 
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docx
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docxRightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docx
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docx
 
Write a program to find the number of comparisons using the binary se.docx
 Write a program to find the number of comparisons using the binary se.docx Write a program to find the number of comparisons using the binary se.docx
Write a program to find the number of comparisons using the binary se.docx
 
IN C LANGUAGE- I've been trying to finish this program for the last fe.docx
IN C LANGUAGE- I've been trying to finish this program for the last fe.docxIN C LANGUAGE- I've been trying to finish this program for the last fe.docx
IN C LANGUAGE- I've been trying to finish this program for the last fe.docx
 
(Unordered Sets) As explained in this chapter, a set is a collection.pdf
(Unordered Sets) As explained in this chapter, a set is a collection.pdf(Unordered Sets) As explained in this chapter, a set is a collection.pdf
(Unordered Sets) As explained in this chapter, a set is a collection.pdf
 
In C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdfIn C++Add the function min as an abstract function to the classar.pdf
In C++Add the function min as an abstract function to the classar.pdf
 
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdfC++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
C++ problemPart 1 Recursive Print (40 pts)Please write the recu.pdf
 
강의자료6
강의자료6강의자료6
강의자료6
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdf
 
강의자료7
강의자료7강의자료7
강의자료7
 
import java.util.; public class IteratorDemo {public static voi.pdf
import java.util.; public class IteratorDemo {public static voi.pdfimport java.util.; public class IteratorDemo {public static voi.pdf
import java.util.; public class IteratorDemo {public static voi.pdf
 
This class maintains a list of 4 integers. This list .docx
 This class maintains a list of 4 integers.   This list .docx This class maintains a list of 4 integers.   This list .docx
This class maintains a list of 4 integers. This list .docx
 
#include fstream#include iostream#include cstdlib#includ.docx
#include fstream#include iostream#include cstdlib#includ.docx#include fstream#include iostream#include cstdlib#includ.docx
#include fstream#include iostream#include cstdlib#includ.docx
 
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
All code should be in C++Using the UnsortedList class (UnsortedLis.pdfAll code should be in C++Using the UnsortedList class (UnsortedLis.pdf
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
 
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdfPLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
 
READ BEFORE YOU START Please read the given Word document fo.pdf
READ BEFORE YOU START  Please read the given Word document fo.pdfREAD BEFORE YOU START  Please read the given Word document fo.pdf
READ BEFORE YOU START Please read the given Word document fo.pdf
 

More from Adamq0DJonese

1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docx
1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docx1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docx
1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docxAdamq0DJonese
 
1) Water soluble compounds have lower bioconcentration factors than do.docx
1) Water soluble compounds have lower bioconcentration factors than do.docx1) Water soluble compounds have lower bioconcentration factors than do.docx
1) Water soluble compounds have lower bioconcentration factors than do.docxAdamq0DJonese
 
1) Spatial Concepts of Location- Direction and Distance (absolute and.docx
1) Spatial Concepts of Location- Direction and Distance (absolute and.docx1) Spatial Concepts of Location- Direction and Distance (absolute and.docx
1) Spatial Concepts of Location- Direction and Distance (absolute and.docxAdamq0DJonese
 
1) How are DNA and RNA similar and how are they different- 2) What are.docx
1) How are DNA and RNA similar and how are they different- 2) What are.docx1) How are DNA and RNA similar and how are they different- 2) What are.docx
1) How are DNA and RNA similar and how are they different- 2) What are.docxAdamq0DJonese
 
1) Identify the following parts of a flower-2) Identify these flowers.docx
1) Identify the following parts of a flower-2) Identify these flowers.docx1) Identify the following parts of a flower-2) Identify these flowers.docx
1) Identify the following parts of a flower-2) Identify these flowers.docxAdamq0DJonese
 
1) design a clocked latch version using NOR gates2) Design the version.docx
1) design a clocked latch version using NOR gates2) Design the version.docx1) design a clocked latch version using NOR gates2) Design the version.docx
1) design a clocked latch version using NOR gates2) Design the version.docxAdamq0DJonese
 
1) Given the following program- Count -0 While (Count !- 5)- Count - C.docx
1) Given the following program- Count -0 While (Count !- 5)- Count - C.docx1) Given the following program- Count -0 While (Count !- 5)- Count - C.docx
1) Given the following program- Count -0 While (Count !- 5)- Count - C.docxAdamq0DJonese
 
1) Explain at least two different things that can happen when a meteor.docx
1) Explain at least two different things that can happen when a meteor.docx1) Explain at least two different things that can happen when a meteor.docx
1) Explain at least two different things that can happen when a meteor.docxAdamq0DJonese
 
1) Assume that you measure the OD of two E-coli cultures- culture A an.docx
1) Assume that you measure the OD of two E-coli cultures- culture A an.docx1) Assume that you measure the OD of two E-coli cultures- culture A an.docx
1) Assume that you measure the OD of two E-coli cultures- culture A an.docxAdamq0DJonese
 
1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docx
1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docx1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docx
1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docxAdamq0DJonese
 
1) A pair of fair dice were tossed- Assuming X represents the sum of t.docx
1) A pair of fair dice were tossed- Assuming X represents the sum of t.docx1) A pair of fair dice were tossed- Assuming X represents the sum of t.docx
1) A pair of fair dice were tossed- Assuming X represents the sum of t.docxAdamq0DJonese
 
1 What are the advantages and disadvantages of globalization- Give exa.docx
1 What are the advantages and disadvantages of globalization- Give exa.docx1 What are the advantages and disadvantages of globalization- Give exa.docx
1 What are the advantages and disadvantages of globalization- Give exa.docxAdamq0DJonese
 
1 point- Regarding chronic disease- which of the following statements.docx
1 point- Regarding chronic disease- which of the following statements.docx1 point- Regarding chronic disease- which of the following statements.docx
1 point- Regarding chronic disease- which of the following statements.docxAdamq0DJonese
 
1 point Which of the following is an example of a Type I error- An inn.docx
1 point Which of the following is an example of a Type I error- An inn.docx1 point Which of the following is an example of a Type I error- An inn.docx
1 point Which of the following is an example of a Type I error- An inn.docxAdamq0DJonese
 
1 Elonis v- United States- is the main case on 875(c)- What is the men.docx
1 Elonis v- United States- is the main case on 875(c)- What is the men.docx1 Elonis v- United States- is the main case on 875(c)- What is the men.docx
1 Elonis v- United States- is the main case on 875(c)- What is the men.docxAdamq0DJonese
 
1 1- A government wants to provide student loans to students in their.docx
1 1- A government wants to provide student loans to students in their.docx1 1- A government wants to provide student loans to students in their.docx
1 1- A government wants to provide student loans to students in their.docxAdamq0DJonese
 
1 a- The analysis of sedimentary rock determines- The size and s.docx
1 a- The analysis of sedimentary rock determines-       The size and s.docx1 a- The analysis of sedimentary rock determines-       The size and s.docx
1 a- The analysis of sedimentary rock determines- The size and s.docxAdamq0DJonese
 
0 points) Answer the questions on ListReferenceBased class (NOTE that.docx
0 points) Answer the questions on ListReferenceBased class (NOTE that.docx0 points) Answer the questions on ListReferenceBased class (NOTE that.docx
0 points) Answer the questions on ListReferenceBased class (NOTE that.docxAdamq0DJonese
 
0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docx
0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docx0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docx
0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docxAdamq0DJonese
 
-Pyro-Diversity- means the many species that grow back after a fire re.docx
-Pyro-Diversity- means the many species that grow back after a fire re.docx-Pyro-Diversity- means the many species that grow back after a fire re.docx
-Pyro-Diversity- means the many species that grow back after a fire re.docxAdamq0DJonese
 

More from Adamq0DJonese (20)

1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docx
1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docx1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docx
1) What are the five tenets of wireless LAN (802-11) troubleshooting- (1).docx
 
1) Water soluble compounds have lower bioconcentration factors than do.docx
1) Water soluble compounds have lower bioconcentration factors than do.docx1) Water soluble compounds have lower bioconcentration factors than do.docx
1) Water soluble compounds have lower bioconcentration factors than do.docx
 
1) Spatial Concepts of Location- Direction and Distance (absolute and.docx
1) Spatial Concepts of Location- Direction and Distance (absolute and.docx1) Spatial Concepts of Location- Direction and Distance (absolute and.docx
1) Spatial Concepts of Location- Direction and Distance (absolute and.docx
 
1) How are DNA and RNA similar and how are they different- 2) What are.docx
1) How are DNA and RNA similar and how are they different- 2) What are.docx1) How are DNA and RNA similar and how are they different- 2) What are.docx
1) How are DNA and RNA similar and how are they different- 2) What are.docx
 
1) Identify the following parts of a flower-2) Identify these flowers.docx
1) Identify the following parts of a flower-2) Identify these flowers.docx1) Identify the following parts of a flower-2) Identify these flowers.docx
1) Identify the following parts of a flower-2) Identify these flowers.docx
 
1) design a clocked latch version using NOR gates2) Design the version.docx
1) design a clocked latch version using NOR gates2) Design the version.docx1) design a clocked latch version using NOR gates2) Design the version.docx
1) design a clocked latch version using NOR gates2) Design the version.docx
 
1) Given the following program- Count -0 While (Count !- 5)- Count - C.docx
1) Given the following program- Count -0 While (Count !- 5)- Count - C.docx1) Given the following program- Count -0 While (Count !- 5)- Count - C.docx
1) Given the following program- Count -0 While (Count !- 5)- Count - C.docx
 
1) Explain at least two different things that can happen when a meteor.docx
1) Explain at least two different things that can happen when a meteor.docx1) Explain at least two different things that can happen when a meteor.docx
1) Explain at least two different things that can happen when a meteor.docx
 
1) Assume that you measure the OD of two E-coli cultures- culture A an.docx
1) Assume that you measure the OD of two E-coli cultures- culture A an.docx1) Assume that you measure the OD of two E-coli cultures- culture A an.docx
1) Assume that you measure the OD of two E-coli cultures- culture A an.docx
 
1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docx
1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docx1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docx
1) Define filtration- phagocytosis- pinocytosis- endocytosis and exocy.docx
 
1) A pair of fair dice were tossed- Assuming X represents the sum of t.docx
1) A pair of fair dice were tossed- Assuming X represents the sum of t.docx1) A pair of fair dice were tossed- Assuming X represents the sum of t.docx
1) A pair of fair dice were tossed- Assuming X represents the sum of t.docx
 
1 What are the advantages and disadvantages of globalization- Give exa.docx
1 What are the advantages and disadvantages of globalization- Give exa.docx1 What are the advantages and disadvantages of globalization- Give exa.docx
1 What are the advantages and disadvantages of globalization- Give exa.docx
 
1 point- Regarding chronic disease- which of the following statements.docx
1 point- Regarding chronic disease- which of the following statements.docx1 point- Regarding chronic disease- which of the following statements.docx
1 point- Regarding chronic disease- which of the following statements.docx
 
1 point Which of the following is an example of a Type I error- An inn.docx
1 point Which of the following is an example of a Type I error- An inn.docx1 point Which of the following is an example of a Type I error- An inn.docx
1 point Which of the following is an example of a Type I error- An inn.docx
 
1 Elonis v- United States- is the main case on 875(c)- What is the men.docx
1 Elonis v- United States- is the main case on 875(c)- What is the men.docx1 Elonis v- United States- is the main case on 875(c)- What is the men.docx
1 Elonis v- United States- is the main case on 875(c)- What is the men.docx
 
1 1- A government wants to provide student loans to students in their.docx
1 1- A government wants to provide student loans to students in their.docx1 1- A government wants to provide student loans to students in their.docx
1 1- A government wants to provide student loans to students in their.docx
 
1 a- The analysis of sedimentary rock determines- The size and s.docx
1 a- The analysis of sedimentary rock determines-       The size and s.docx1 a- The analysis of sedimentary rock determines-       The size and s.docx
1 a- The analysis of sedimentary rock determines- The size and s.docx
 
0 points) Answer the questions on ListReferenceBased class (NOTE that.docx
0 points) Answer the questions on ListReferenceBased class (NOTE that.docx0 points) Answer the questions on ListReferenceBased class (NOTE that.docx
0 points) Answer the questions on ListReferenceBased class (NOTE that.docx
 
0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docx
0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docx0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docx
0 Conditional Format as Cell Cells Formatting - Table - Styles - Style.docx
 
-Pyro-Diversity- means the many species that grow back after a fire re.docx
-Pyro-Diversity- means the many species that grow back after a fire re.docx-Pyro-Diversity- means the many species that grow back after a fire re.docx
-Pyro-Diversity- means the many species that grow back after a fire re.docx
 

Recently uploaded

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Recently uploaded (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

-- Reminder that your file name is incredibly important- Please do not.docx

  • 1. // Reminder that your file name is incredibly important. Please do not change it. // Reminder that we are compiling on Gradescope using GCC. // READ BEFORE YOU START: // You are given a partially completed program that creates a list of game items like you'd see in a folder. // Each item has this information: item's name, game's name, type of item, item ID. // The struct 'itemRecord' holds information of one item. Variety is an enum. // An array of structs called 'list' is made to hold the list of items. // To begin, you should trace through the given code and understand how it works. // Please read the instructions above each required function and follow the directions carefully. // You should not modify any of the given code, the return types, or the parameters. Otherwise, you risk getting compilation errors. // You are not allowed to modify main(). // You can use string library functions. // WRITE COMMENTS FOR IMPORANT STEPS IN YOUR CODE. #include <stdio.h> #include <stdlib.h> #include <string.h> #pragma warning(disable: 4996) // for Visual Studio Only #define MAX_ITEMS 15 #define MAX_NAME_LENGTH 25 typedef enum { Health = 0, Equip, Etc } itemType; // enum type struct itemRecord { // struct for item details char itemName[MAX_NAME_LENGTH]; char gameName[MAX_NAME_LENGTH]; itemType variety; unsigned int itemID; }; struct itemRecord list[MAX_ITEMS]; // declare list of items int count = 0; // the number of items currently stored in the list (initialized to 0) // functions already implmented void flushStdIn(); void executeAction(char); void save(char* fileName); void display(); // functions that need implementation: int add(char* itemName_input, char* gameName_input, char* variety_input, unsigned int idNumber_input); // 10 points void sort(); // 10 points int delete(unsigned int idNumber_input); // 10 points
  • 2. void load(char* fileName); // 10 points int main() { char* fileName = "Item_List.txt"; load(fileName); // load list of items from file (if it exists). Initially there will be no file. char choice = 'i'; // initialized to a dummy value do { printf("nEnter your selection:n"); printf("t a: add a new itemn"); printf("t d: display item listn"); printf("t r: remove an item from listn"); printf("t s: sort item list by IDn"); printf("t q: quitn"); choice = getchar(); flushStdIn(); executeAction(choice); } while (choice != 'q'); save(fileName); // save list of items to file (overwrites file, if it exists) return 0; } // flush out leftover 'n' characters void flushStdIn() { char c; do c = getchar(); while (c != 'n' && c != EOF); } // ask for details from user for the given selection and perform that action void executeAction(char c) { char itemName_input[MAX_NAME_LENGTH], gameName_input[MAX_NAME_LENGTH]; unsigned int idNumber_input, add_result = 0; char variety_input[20]; switch (c) { case 'a': // input item record from user printf("nEnter item name: "); fgets(itemName_input, sizeof(itemName_input), stdin); itemName_input[strlen(itemName_input) - 1] = '0'; // discard the trailing 'n' char printf("Enter game name: ");
  • 3. fgets(gameName_input, sizeof(gameName_input), stdin); gameName_input[strlen(gameName_input) - 1] = '0'; // discard the trailing 'n' char printf("Enter whether item is a 'Health' or 'Equip' or 'Etc' item: "); fgets(variety_input, sizeof(variety_input), stdin); variety_input[strlen(variety_input) - 1] = '0'; // discard the trailing 'n' char printf("Please enter item ID number: "); scanf("%d", &idNumber_input); flushStdIn(); // add the item to the list add_result = add(itemName_input, gameName_input, variety_input, idNumber_input); if (add_result == 0) printf("nItem is already on the list! nn"); else if (add_result == 1) printf("nItem successfully added to the list! nn"); else printf("nUnable to add. Item list is full! nn"); break; case 'r': printf("Please enter ID number of item to be deleted: "); scanf("%d", &idNumber_input); flushStdIn(); int delete_result = delete(idNumber_input); if (delete_result == 0) printf("nItem not found in the list! nn"); else printf("nItem deleted successfully! nn"); break; case 'd': display(); break; case 's': sort(); break; case 'q': break; default: printf("%c is invalid input!n", c); } } // This function displays the employee list with the details (struct elements) of each employee. void display() { char* varietyString = "Health"; // dummy init for (int i = 0; i < count; i++) // iterate through the list {
  • 4. printf("nItem name: %s", list[i].itemName); // display item's name printf("nGame name: %s", list[i].gameName); // display game's name if (list[i].variety == Health) // find what to display for item type varietyString = "Health"; else if (list[i].variety == Equip) varietyString = "Equip"; else varietyString = "Etc"; printf("nItem Type: %s", varietyString); // display item type printf("nID Number: %d", list[i].itemID); // display item's ID printf("n"); } } // save() is called at the end of main() // This function saves the array of structures to file. It is already implemented. // You should read and understand how this code works. It will help you with 'load()' function. // save() is called at end of main() to save the item list to a file. // The file is saved at the same place as your C file. // You can simply delete the file to 'reset the list' or to avoid loading from it. void save(char* fileName) { FILE* file; int i, varietyValue = 0; file = fopen(fileName, "wb"); // open file for writing fwrite(&count, sizeof(count), 1, file); // First, store the number of employees in the list // Parse the list and write employee record to file for (i = 0; i < count; i++) { fwrite(list[i].itemName, sizeof(list[i].itemName), 1, file); fwrite(list[i].gameName, sizeof(list[i].gameName), 1, file); // convert enum to a number for storing if (list[i].variety == Health) varietyValue = 0; // 0 for HR else if (list[i].variety == Equip) varietyValue = 1; // 1 for Marketing else varietyValue = 2; // 2 for ITs fwrite(&varietyValue, sizeof(varietyValue), 1, file);
  • 5. fwrite(&list[i].itemID, sizeof(list[i].itemID), 1, file); } fclose(file); // close the file after writing } // Q1 : add (10 points) // This function is used to add an item into the list. You can simply add the new item to the end of list (array of structs). // Do not allow the item to be added to the list if it already exists in the list. You can do that by checking item names OR IDs already in the list. // If the item already exists then return 0 without adding it to the list. If the item does not exist in the list, then add the item at the end of the list and return 1. // If the item list is full, then do not add new item to the list and return 2. // NOTE: Notice how return type of add() is checked in case 'a' of the executeAction() function. // NOTE: You must convert the string 'variety_input' to an enum type and store it in the list because the item type has enum type (not string type). // The list should be case sensitive. For instance, 'Mega Death Sword' and 'mega death sword' should be considered two different names. // Hint: the global variable 'count' holds the number of items currently in the list int add(char* itemName_input, char* gameName_input, char* variety_input, unsigned int idNumber_input) { itemType item_enum; // Write the code below. return 0; // edit this line as needed } // Q2 : sort (10 points) // This function is used to sort the list (array of structs) numerically by the item's ID. // Parse the list and compare the item IDs to check which one should appear before the other in the list. // Sorting should happen within the list. That is, you should not create a new list of structs having sorted items. // Hint: Use a temp struct (already declared) if you need to swap two structs in your logic void sort() { struct itemRecord itemTemp; // needed for swapping structs. Not absolutely necessary to use. // Write the code below. // display message for user to check the result of sorting. Do not touch this printf("nItem list sorted! Use display option 'd' to view sorted list.n");
  • 6. } // Q3 : delete (10 points) // This function is used to delete an item by ID. // Parse the list and compare the item IDs to check which one should be deleted. // Restore the array structure after removal of the item record. // Return 0 if the specified ID was not found. Return 1 upon successful removal of a record. int delete(unsigned int idNumber_input) { struct itemRecord itemTemp; // useful for swapping structs. Not absolutely necessary to use. // Write the code below return 0; // edit this line as needed } // Q4: load (10 points) // This function is called in the beginning of main(). // This function reads the item list from the saved file and builds the array of structures 'list'. // In the first run of the program, there will be no saved file because save() is called at the end of program. // So at the begining of this function, write code to open the file and check if it exists. If file does not exist, then return from the function. // (See expected output of add() in homework question file. It displays "Item_List.txt not found" because the file did not exist initially.) // If the file exists, then parse the item list to read the employee details from the file. // Use the save function given above as an example of how to write this function. Notice the order in which the struct elements are saved in save() // You need to use the same order to read the list back. // NOTE: The saved file is not exactly readable because all elements of the struct are not string or char type. // So you need to implement load() similar to how save() is implemented. Only then the 'list' will be loaded correctly. // You can simply delete the file to 'reset the list' or to avoid loading from it. void load(char* fileName) { // Write the code below. // The following two print statements are used in your code. You can change their position but not their contents. printf("%s not found.n", fileName); printf("Item record loaded from %s.n", fileName); }