Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

- [10pts]
Identify all function prototypes, function definitions,
function calls, function arguments, and function parameters
in the program below.
`#include <iostream> #include <fstream> using namespace std; bool readRow(int len); int main() { int rows, cols; char t; cin >> rows >> t >> cols; int count = 0; for( int r = 0; r < rows; r++ ) if( readRow(cols) ) count++; cout << count << endl; return 0; } bool readRow(int len) { int n = 0; for( int i = 0; i < len; i++ ) { char c; cin >> c; if( c == 'Y' ) n++; } return n > 0; }`

- [20pts] Consider the following function
`printNumbers`

:

As you see, this function prints a sequence of`// prototype void printNumbers(int start, int n); // definition void printNumbers(int start, int n) { for( int i=0; i < n; i++ ) { int m = start + i; if( m < 10 ) cout << " "; cout << m << " "; } cout << endl; }`

`n`

incrementally increasing numbers starting with`start`

.Rewrite the code of printing Hankel matrix shown in Class 11. Your code should use function

`printNumbers`

(copy the above code snippet and paste in in your code) and work the same as the Hankel-matrix code given in the notes.**Turn In**a printout of your program along with a screen capture showing your program running on the input 15. - [70pts]
Write a program that reads in a list of fractions from the user, each
separated by commas and the whole terminated by a semicolon, prints out the
ones that are not in lowest terms. For example, a typical run might look like
this:
~/$ ./hw 2/4, 6/9, 3/11, 21/5, 8/10; 2/4 is not in lowest terms! 6/9 is not in lowest terms! 8/10 is not in lowest terms!

In writing this program, define and use a function`int gcd(int,int);`

that takes two positive integers and returns their greatest common divisor. (Check out Class 9 to remind yourself about computing gcd's.)**Turn In**a printout of your program along with a screen capture showing your program running on the above input (and, of course, this sheet).