Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a text file, Users.txt, uploaded into the assignment folder, create a program with the following functionality. Try to explain to me, demonstrating your knowledge

Given a text file, “Users.txt”, uploaded into the assignment folder, create a program with the following functionality.

Try to explain to me, demonstrating your knowledge of the course, and C programming how you can keep track of Directories and Users who are assigned those Directories.

Your program should have 10 Directories that have been created. Make those 5 of those Directories to belong to five users, with Username, User1, User2, User5. You have 10 Directories Dir1, to Dir10. Directories Dir6 to Dir10 are not occupied.

Each occupied Directory should contain a file with a username of the user that contains the directory. For example, contents of Dir1 has a user called User1, and it has a file called User1.txt. Also create some structure that represent Users and Directories, so that you can always tell which Directory is occupied, and by who.

Create and add the following function to locate the numbered free Directories. If every Directory is occupied, then it should return 0.

int findfree()

Create and add the following function to remove a User from his/her Directory.

void freeroom(int Directoryno)

Create and add the following function to place a new User into a Directory. You have to first check whether the Directory is empty first. If it is not empty, then it you print an error message and exit.

void addDirectory(char* name, int Directory)

Use the given main() function to compile and run your program.

Use the given “Users.txt” file as the file containing occupants information.

You also need to include the definition of the getoccupier() function into your program since the given main() will make use of that, too.

The

The “Users.txt” file can be formatted different ways. Make your choice.

Submit the following in MS Word file:

Your complete code in text format.

Screenshots showing successful compilation

Screenshots showing running and output of your program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

To implement this functionality in C programming well start by defining structures to represent users and directories Then well create functions to fi... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Cost Accounting A Managerial Emphasis

Authors: Charles T. Horngren, Srikant M.Dater, George Foster, Madhav

14th Edition

978-0132960649, 132960648, 132109174, 978-0132109178

More Books

Students also viewed these Accounting questions