// BoxOfStars.C
// Math 120 solution to Homework 3, problem 2.

#include<iostream.h>

// print lineSize starts to a line, upto exactly starCount
// stars.

void printLine( int count ) {
   if ( count==0 ) {
      cout << endl ;
   }
   else {
      cout << "*" ;
      printLine( count - 1 ) ;
   }
}

void printBox( int ls, int count ) {
   if ( count==0 ) {
      ; // done
   }
   else if ( count <= ls ) {
      printLine( count ) ;
   }
   else {
      printLine( ls ) ;
      printBox( ls, count-ls ) ;
   }
}

void main() {
   int lineSize ;
   int starCount ;

   cout << "Enter Line Size:" ;
   cin >> lineSize ;
   if ( lineSize < 1 ) {
      cout << "Line Size must be positive." << endl ;
      return ;
   }
   cout << "Enter Star Count:" ;
   cin >> starCount ;
   if ( starCount < 1 ) {
      cout << "Star Count must be positive." << endl ;
      return ;
   }

   printBox( lineSize, starCount ) ;

}
