Lab 5: Inheritance
Labs are practice problems which, time permitting, may be started or completed in your lab, and are assessed on correctness only. You are encouraged to collaborate with classmates on this lab, though each member in a group collaborating is expected to contribute equally to the lab.
Simulate the inheritance of blood types for each member of a family.
$ ./inheritance
Child (Generation 0): blood type OO
Parent (Generation 1): blood type AO
Grandparent (Generation 2): blood type OA
Grandparent (Generation 2): blood type BO
Parent (Generation 1): blood type OB
Grandparent (Generation 2): blood type AO
Grandparent (Generation 2): blood type BO
Getting Started
Open VS Code.
Start by clicking inside your terminal window, then execute cd
by itself. You should find that its “prompt” resembles the below.
$
Click inside of that terminal window and then execute
wget https://cdn.cs50.net/2022/fall/labs/5/inheritance.zip
followed by Enter in order to download a ZIP called inheritance.zip
in your codespace. Take care not to overlook the space between wget
and the following URL, or any other character for that matter!
Now execute
unzip inheritance.zip
to create a folder called inheritance
. You no longer need the ZIP file, so you can execute
rm inheritance.zip
and respond with “y” followed by Enter at the prompt to remove the ZIP file you downloaded. Finally, right-click on the inheritance
folder and click “Open in CS50 Lab”. You should see the specification for this problem on the left-hand side and its distribution code on the right-hand side.