C language program  bloodtype1  to compute inheritance of blood types

 As an example of text-based computer programming using the C language, the program  bloodtype1  computes all possible blood types for a mother, father, or child if the blood type is known for the other 2 of those 3 people.

The file  BloodType1_02.zip  (129,409 bytes)  contains the following 16 files that relate to Revision 1.02 (dated 2/19/2008) of the program  bloodtype1.

Size in bytes Filename Description
54 blood11InACM.txt Input  data for the ACM 2007 programming contest problem
135 blood11OutACM.txt Output data for the ACM 2007 programming contest problem
805 blood12InAllFindMom.txt Input  data to find mom's types for all 64 dad's and kid's types
2,780 blood12OutAllFindMom.txt Output data showing mom's types for all 64 dad's and kid's types
805 blood13InAllFindDad.txt Input  data to find dad's types for all 64 mom's and kid's types
2,780 blood13OutAllFindDad.txt Output data showing mom's types for all 64 dad's and kid's types
853 blood14InAllFindKid.txt Input  data to find kid's types for all 64 mom's and dad's types
2,670 blood14OutAllFindKid.txt Output data showing kid's types for all 64 mom's and dad's types
120,901 bloodtype1.c C source code for the program (ready to be compiled)
208,451 bloodtype1.c.html HTML for C source code with text colored by the "vim" editor
22,261 bloodtype1.c_c C source code with line numbers but no comments (for reading)
143,099 bloodtype1.c_n C source code with comments and line numbers (for reading)
40,960 bloodtype1.exe Executable program for Windows "Start | Run ..." or command line
4,192 bloodtype1.txt Online help printed by command  "bloodtype1 -h"  (98 text lines)
27,191 bloodtype1_Sec.c C source code with almost all comments removed (for reading)
65,804 bloodtype1_Sec.c.html HTML for colored C source code with almost all comments removed

The C source code in each of the files  bloodtype1.c,  bloodtype1.c_n,  and  bloodtype1.c.html  contains 2664 lines of program text, including 2182 lines of extensive comments plus 482 noncomment code lines.   File  bloodtype1.c_c  contains only the 482 noncomment lines of code (after removing all comments), but keeping the original line numbers as in files  bloodtype1.c  and  bloodtype1.c_n).   Each of the files  bloodtype1_Sec.c  and  bloodtype1_Sec.c.html  has 577 lines containing source code with almost all comments removed, but retains comments for section headings and a few other selected comments to make the code more readable.

File  bloodtype1.txt  explains how to use the program  bloodtype1.

The first 389 comment lines of the file  bloodtype1.c  describe the program, ABO blood groups, Rh+ and Rh- factors, blood genotypes and phenotypes, the immune system reaction to blood types, genetic inheritance, and the importance of the Rh factor for pregnancy.

After the 4 files of input data were typed, the 4 respective output data files were generated by redirecting input and output by running the 4 commands

bloodtype1  < blood11InACM.txt  > blood12OutAllFindMom.txt
bloodtype1  < blood12InAllFindMom.txt  > blood12OutAllFindMom.txt
bloodtype1  < blood13InAllFindDad.txt  > blood13OutAllFindDad.txt
bloodtype1  < blood14InAllFindKid.txt  > blood14OutAllFindKid.txt

The last 3 output files mentioned just above show examples of all possible cases that program  bloodtype1  can compute.