getline
function
Subfolder
“Using_getline
” in the shared
folder.
In the file under Using_getline
, called
using_getline.c
, write a program
with these features:
An structure called struct survey
which stores
the name of a person( with no fixed length) and a field which stores
the street of the person if this person lives in Leganés, or the district
if the person does not live in Leganés.
Hint: You will need a field to know if the person lives in Leganés
or does not.
Function void data_enter(struct survey *ptr):
This function asks the user to enter his or her name.
Then it asks the user whether he or she is a Leganés citizen.
If the answer is Yes (Y), it asks the user to enter the name of
their address. Otherwise (N), it asks the user to enter the name of
the district he or she comes from.
Function void data_display(struct survey *ptr):
This function prints the name of the user
and either the address if he or she is a Leganés citizen,
or their district.
Fill the main
function so that it first gets the data from the user and, second,
prints the data on the screen, with the help of the previous two functions.
When finished, upload the file to the repository with svn commit
.