Starting from:

$29

Homework #1 – Structures and Pointers

EGRE-246
Homework #1 – Structures and Pointers
This homework must be your own (individual) work as defined in the course syllabus and
discussed in class.
1) Write a C program that behaves like a password manager (no encryption is needed).
This password manager can hold up to 5 entries where each entry contains the
following items:
 Name of the website - char array of size 32
 Username for the website – char array of size 32
 Password for the website – char array of size 32
Each entry containing the above items should be coded as a struct in your main()
program and you should then also create an array of structs that can hold 5 entries.
The type-name of the struct should be “entry”.
a) At the beginning of the program the program has to ask the user to input all the
entries in to the password managers (the program has to ask the user 5 times for a
website name, username and password). This should be done by calling a function
with the following declaration:
void requestEntry(struct entry *data);
The above function asks the user to input one entry requesting the website’s
name, username and password and stores this in the “data” structure. The user
input does not have to be validated. All inputs are considered to be sentences
without spaces.
b) Once all entries are requested and entered by the user, the program should display
a list with the array index and the website’s name. This should be done by calling
the following function:
void displaySummary(struct entry *data, int numberOfEntries);
See above screenshot for how the summary is displayed.
c) The user can then input any index number from 1 to 5 to display the full
information of website name, username and password. This should be done again
by calling a function with the following declaration:
void displayEntry(struct entry *data);
To exit the program the user has to type in 0. The user input should be checked
and if an incorrect key is pressed the user should be warned by a message.
2) The functions requestEntry(), displaySummary(), and displayEntry() should be placed
in a separate source file (functions.c) with accompanying header file (functions.h).
The header file should also include the struct declaration.
For this assignment, you must turn in a zip file with all of your C header files, source
code files, and a working Makefile to compile your solution. Turn in your assignment
by attaching the zip file to the assignment submission page.
Remember the class policy on late submissions – no late submissions are allowed
unless prior arrangement is made with the instructor.

More products