Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
#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;
}
~/$ ./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 10 to remind yourself about
computing gcd's.) Turn In this cover sheet, along with a
printout of your program
along with a screen capture showing your program running on the
above input (and, of course, this sheet).
void rep(int k, char c); that simply prints
k copies of the character c to standard
output (i.e. with cout). Write a code fragment using this
function to print a hollow rectangle of *'s to the screen
(as in an earlier homework) of dimension height 40 and width 65
characters, indented by 15 spaces.