<!DOCTYPE html>
<!-- saved from url=(0097)https://content.byui.edu/file/cddfb9c0-a825-4cfe-9858-28d5b4c218fe/1/Prepare/124.2.5.Prepare.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
        <title>Prepare 2.5 : Loop Design</title>
    <link href="./Prepare 2.5 _ Loop Design_files/styles.css" rel="stylesheet" type="text/css">
</head>
<body style="">
  <div id="main" class="splash">
    <div id="header">
       <img class="banner" alt="CS 124 Banner" title="CS 124 Banner" src="./Prepare 2.5 _ Loop Design_files/124.2.Banner.jpg">
    </div> <!-- id="header" -->

    <article>

                <h1>Prepare 2.5 : Loop Design</h1>
                <p>Write a function (<code>displayTable()</code>) to display a calendar on the screen.  
                The function will take two parameters:</p>
        <ul>
                <li><code>numDays</code>: The number of days in a month.</li>
                        <li><code>offset</code>: The offset from Monday.  If the offset is zero, then the month starts on Monday.  
                        If the offset is 2, the month starts on Wednesday.  If the offset is 6, the month starts on Sunday.</li>
        </ul>
        
        <p>This function will be "very similar" to the <code>displayTable()</code> function in Ponder 07 : Calendar.  
                        Please see the project for details on the spacing between the columns
                and a hint on how the algorithm might work.
                Note that your program must work with loops; do not attempt to "hard code" the program
                        with a couple IF statements and COUTs.
                Next write <code>main()</code> so that it prompts the user for the number of days in the month and the offset.</p>
                
        <p>Note that this is probably the most difficult assignment of the semester.  
                        Of course, this will also get you very far along on the project as well.  
                Please, allocate a couple hours for this assignment. </p>
                
        <h2>Example</h2>
        <p>Three examples. The user input is <span class="input">underlined</span>.</p>
<pre>Number of days: <span class="input">30</span>
Offset: <span class="input">3</span>
  Su  Mo  Tu  We  Th  Fr  Sa
                   1   2   3
   4   5   6   7   8   9  10
  11  12  13  14  15  16  17
  18  19  20  21  22  23  24
  25  26  27  28  29  30        
</pre>
                <p> </p>  
<pre>Number of days: <span class="input">28</span>
Offset: <span class="input">0</span>
  Su  Mo  Tu  We  Th  Fr  Sa
       1   2   3   4   5   6
   7   8   9  10  11  12  13
  14  15  16  17  18  19  20
  21  22  23  24  25  26  27
  28    
</pre>
                <p> </p>
<pre>Number of days: <span class="input">31</span>
Offset: <span class="input">6</span>
  Su  Mo  Tu  We  Th  Fr  Sa
   1   2   3   4   5   6   7
   8   9  10  11  12  13  14
  15  16  17  18  19  20  21
  22  23  24  25  26  27  28
  29  30  31
</pre>

                <h2>Assignment</h2>
                <p>The test bed is available at:</p>
                <div class="code"><code>testBed cs124/assign25 assignment25.cpp</code></div>
        <p>Don't forget to submit your assignment with the name "Assignment 25" in the header.</p>


    </article> 
   </div> <!-- id="main" -->
 

<iframe src="./Prepare 2.5 _ Loop Design_files/save-product.html" id="save-frame" style="top: 0px; right: 0px; display: none; width: 65px; height: 45px; z-index: 2147483647; border-style: none; overflow: visible; clip: initial; opacity: initial; position: fixed !important;"></iframe><iframe src="./Prepare 2.5 _ Loop Design_files/index.html" id="save-item-frame" scrolling="no" style="width: 55px; top: 0px; right: 0px; display: none; z-index: 2147483647; border-style: none; overflow: hidden; clip: initial; position: fixed !important; height: 50px;"></iframe></body></html>