diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-14 04:59:29 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-14 04:59:29 +0000 |
commit | ba93a5dca5f93fe7b5761c251037d4f1860f9a43 (patch) | |
tree | 0062e064bf6a0d38803d68368cdf50244bffc26f /wk5/pset/inheritance | |
parent | c5acde50d12853d12736435f27a7c3f63fd92d79 (diff) |
Sat, Apr 13, 2024, 9:59 PM -07:00
Diffstat (limited to 'wk5/pset/inheritance')
-rw-r--r-- | wk5/pset/inheritance/inheritance.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/wk5/pset/inheritance/inheritance.c b/wk5/pset/inheritance/inheritance.c index d973b67..7e5916a 100644 --- a/wk5/pset/inheritance/inheritance.c +++ b/wk5/pset/inheritance/inheritance.c @@ -1,10 +1,10 @@ // Simulate genetic inheritance of blood type +#include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> -#include <math.h> // Each person has two parents and two alleles typedef struct person @@ -112,11 +112,13 @@ void print_family(person *p, int generation) // Print person if (generation == 0) { - printf("Child (Generation %i): blood type %c%c\n", generation, p->alleles[0], p->alleles[1]); + printf("Child (Generation %i): blood type %c%c\n", generation, p->alleles[0], + p->alleles[1]); } else if (generation == 1) { - printf("Parent (Generation %i): blood type %c%c\n", generation, p->alleles[0], p->alleles[1]); + printf("Parent (Generation %i): blood type %c%c\n", generation, p->alleles[0], + p->alleles[1]); } else { @@ -124,7 +126,8 @@ void print_family(person *p, int generation) { printf("Great-"); } - printf("Grandparent (Generation %i): blood type %c%c\n", generation, p->alleles[0], p->alleles[1]); + printf("Grandparent (Generation %i): blood type %c%c\n", generation, p->alleles[0], + p->alleles[1]); } // Print parents of current generation |