$24
Question-1
Suppose that you have a text file named contacts.txt listing name (maximum 15 characters), last name (maximum 15 characters) and birth date (in the format dd.mm,yyyy) of people. We do not know how many records are given in that text file but we know that there are at most 100 records in that file. A sample text file is provided below.
contacts.txt
PATRICIA JOHNSON 01-02-2000
LINDA WILLIAMS 02-04-1980
BARBARA BROWN 09-01-1995
ELIZABETH JONES 29-05-1960
JENNIFER MILLER 15-08- 1985
MARIA DAVIS 19-06-1999
Write a C program and:
Create a structure named date, to store day, month and year of the date.
Create another structure named contact to store each person’s name, lastname and birth date information.
Write a function named loadContact to read all records of the text file contacts.txt in an appropriate way.
Your main program should then list all contacts whose age is in between 18 and 25 in the format provided in sample run below.
Sample run for the given input file:
P. JOHNSON, 18
B. BROWN, 23
M. DAVIS, 19
Question-2
Write a C program to implement an encryption algorithm described below. In this encryption technique, each letter of a given input word is replaced by a letter some fixed number of positions down the alphabet.
Your program will input a word and an integer value as input values. The integer value indicates the number of position each letter of the word has been moved down. You are given the following sample runs as examples.
Sample Run-1
Enter a word: computer
Enter a number: 4
Encrypted text: gsqtyxiv
Sample Run-2
Enter a word: ZOEY
Enter a number: 4
Encrypted text: DSIC
Sample Run-3
Enter a word: CScience
Enter a number: 5
Encrypted text: HXhnjshj
Hints:
You are given a sample C program which reads name and phone number from a file and prints in the console.
input.txt
sample.c
How to submit
Please also use the following file format while naming the zip file:
LastNameFirstnameX_Y.zip where LastNameFirstname is your last name with the first letter in capital, followed by your first name with the first letter in capital; the X is the course code; the Y is the assignment #. (ex: SerceFatmaCS351_2.zip)
Upload the zip file to CANVAS.
How to evaluate
Your program should
meet the requirements as shown in sample runs
include comments to explain your program
be easy to follow
work for all possible inputs
include proper input and output messages