subject

This lab, for which you may work in groups of two, will require you to use a C structure to hold a record of any kind of data, i. e., address book, library of books as with chapter 14, etc. These records will be held in dynamic memory using memory allocation (malloc) to create new memory and the function (free) to release memory created via (malloc). Do not use linked lists for this assignment, we are using dynamic memory allocation to hold records, not using linked lists. The structures will act as an in memory database for your records (structures), and you will need to create enough memory to hold all of your records, but also when you remove records, you will need to allocate new memory, move the data over to that memory space, and free the old memory (instead of using a static size array). No use of arrays is allowed to hold your structures, but you can use arrays in other places in your program. Your program will prompt for information that will be added to a new structure that will be added when you call the add function. Delete is as simple as just taking the last record out of your database (i. e. no need to search for a "record" to delete - this assignment is about pointers and memory allocation / free, so no need to make the algorithm more complicated). In addition to your memory to hold your data / structures, your program will also need to hold a static duration memory type that will serve as the counter for how many times the database has changed. Along with the amount of times the database has changed, you will also need to have a variable to hold the number of records in your database, functions to calculate size (records multiplied by sizeof struct), and functions to add, print, and delete records. You will not be required to use lookup functions, print is just the entire database. To manage your in-memory database, you will need to use some pointers to hold locations of your data. Please take some time to write down examples of where you will need to have pointers. You will need to have at least a pointer to the beginning of your database memory, another to show which record you are on, but think about the need for other pointers when you think about functions that will delete a record, add a record, etc. One of the major points of this assignment is not just the ability to manage records in memory, it is also about how to manage the memory itself. There is a huge inherent danger in how memory is allocated and subsequently not released properly which will create a "memory leak" in your program which will consume memory over time and crash your system (due to all the memory being used, or your process hitting a max limit of memory). This will mean that you will need to manage how pointers are pointing at data very carefully as it is very easy to create a memory leak and your program will not crash, it will just not release memory properly. You will need a menu to prompt users for the above requirements that may look like: MENU 1. Print all records 2. Print number of records 3. Print size of database 4. Add record 5. Delete record 6. Print number of accesses to database 7. Exit Once you have gathered the appropriate information you will need to manipulate the data to hold the data correctly, but we are not using File I/O to maintain state on the data (would require too much time). Your database is a memory only database, so once your program ends, your database is gone. Being this is the case, it will be important to create a header file that has some data in it (5-7 records), so you will not need to enter all the records every time. You will need to create a design doc as you did with project #1 that describes the reason for the program, the data type and how it will be used (also note the static type for number of accesses to your database) as well as testing criteria. For this assignment you will need to use "script" to capture you testing your test cases while using your program. Script is a program that will capture everything you do on your screen until you exit the script program. To enter the script program simply type in : $ script myProject2.out This will start copying everything you type (stdin) as well as everything that goes to the screen until you type in exit at the $ prompt (you are actually in a new shell, so you won’t get logged out).. Please submit all source/text/script files via the Project #2 Assignment in Moodle (only use zip or tar/tar. gz - no rar). Please also use the forum for project #2 for Q&A and discussion) Grading Rubric

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, bl88676
1. before plugging in a new device to a computer you should unplug all other devices turn off the computer turn on the computer 2. many of the maintenance tools for a computer can be found in the control panel under administrative tools display personalization
Answers: 1
image
Computers and Technology, 24.06.2019 01:30, kellygaytan
Suppose a cpu with a write-through, write-allocate cache achieves a cpi of 2. what are the read and write bandwidths (measured by bytes per cycle) between ram and the cache? (assume each miss generates a request for one block.)
Answers: 1
image
Computers and Technology, 24.06.2019 10:20, savyblue1724707
Identify the publisher in this citation: carter, alan. a guide to entrepreneurship. new york: river’2008.print.
Answers: 3
image
Computers and Technology, 24.06.2019 11:20, isabelperez063
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
You know the right answer?
This lab, for which you may work in groups of two, will require you to use a C structure to hold a r...

Questions in other subjects:

Konu
Mathematics, 17.09.2020 14:01
Konu
English, 17.09.2020 14:01
Konu
Mathematics, 17.09.2020 14:01
Konu
Mathematics, 17.09.2020 14:01
Konu
English, 17.09.2020 14:01
Konu
Spanish, 17.09.2020 14:01
Konu
Biology, 17.09.2020 14:01
Konu
Mathematics, 17.09.2020 14:01
Konu
English, 17.09.2020 14:01
Konu
Mathematics, 17.09.2020 14:01