Homework 12: fscanf
Name: _____________________________________________ Alpha: ___________________
Describe help received: ________________________________________________________
- Due before class on Wednesday, February 8
- This homework contains code to be submitted electronically.
Put your code in a folder called
hw12and submit using the204subcommand. - This is an electronic homework and you do not need to print out anything to turn in during class.
Assignment
- Required reading: Sections 3 (Pointers) and 4 (fscanf) from the Unit 4 notes,
-
Write a program called
age.cthat reads a name and a birthday such as "Philip 1/31/1937" and prints out a line with their age as of February 6, 2017, for example "Philip is 80 years old."roche@ubuntu$./agePhilip 1/31/1937Philip is 80 years old.roche@ubuntu$./ageSteve 10/3/1936Steve is 80 years old.You must use a
fscanfstatement to read in the input line! Note that someone born on February 6 would be considered to have their birthday already, so someone born on 2/7/2016 would be0 years oldwhile someone born on 2/6/2016 would be1 years old.