Commit 0e78210c authored by Dominik Widhalm's avatar Dominik Widhalm
Browse files

Minor bugfix in example solution task 6.15

parent 26364134
......@@ -89,10 +89,14 @@ person_t *person_new (addtype_t type, person_t *child) {
printf("Please enter %s's first name: ",query);
/* Read in the user's input */
fgets(new->firstname,STRING_MAX,stdin);
/* Remove newline from string */
new->firstname[strlen(new->firstname)-1] = '\0';
/* Ask the user to enter the person's family name */
printf("Please enter %s's family name: ",query);
/* Read in the user's input */
fgets(new->familyname,STRING_MAX,stdin);
/* Remove newline from string */
new->familyname[strlen(new->familyname)-1] = '\0';
/* Initially set its Kekule number to 0 */
new->kekule = 0;
/* Initially set its parent pointers to NULL */
......@@ -335,7 +339,7 @@ int main (void) {
/* Ask the user if he/she wants to add a new level of parents */
printf("Do you want to add a new level (y/n): ");
/* Read in the user's response */
scanf(" %c",&input);
scanf(" %c%*c",&input);
/* Check if user wants to add a new level */
if (input == 'y') {
/* (Try to) add a new level of ancestors */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment