This figure shows the equivalent Python and C++ code for computing the greatest common denominator (gcd). You've likely seen the python code before; now we'll begin creating the C++ version.
Go ahead and begin typing in the code for the C++ version. Remember to be careful with upper- and lower-case, as C++ is case-sensitive. Also be sure to be careful with all syntax, e.g. { } ; ( ) << >> etc.
Depending upon your comfort with typing in the code, you may want to enter the code in parts, compile it (to verify correctness), and then enter more code. The best way to do this is to enter the procedure declarations first with empty code bodies, compile, then enter the first level code bodies, compile, and then finally the second level code bodies (i.e. the while loop's code body), and compile. See below for the commands for compiling.
First value: 30 Second value: 18 gcd: 6
Uncomment line 7 to restore the original file.
Restore line 4 to its original form.
Restore line 19 to its original form.
Restore the { at line 8 before continuing.
Restore line 13 to its original form.