User Tools

Site Tools


user:acrowle1:portfolio:cprogproject4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:acrowle1:portfolio:cprogproject4 [2014/03/09 15:21] acrowle1user:acrowle1:portfolio:cprogproject4 [2014/03/23 16:58] (current) – [Reflection] acrowle1
Line 1: Line 1:
- <!DOCTYPE html> +======Projectdayofweek======
-<html lang="en" dir="ltr" class="no-js"> +
-<head> +
-    <meta charset="utf-8" /> +
-    <title>user:project_template [Lab46 Wiki]</title> +
-    <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script> +
-    <meta name="generator" content="DokuWiki"/> +
-<meta name="robots" content="index,follow"/> +
-<meta name="date" content="2013-01-23T20:10:36-0500"/> +
-<meta name="keywords" content="user,project template"/> +
-<link rel="search" type="application/opensearchdescription+xml" href="/lib/exe/opensearch.php" title="Lab46 Wiki"/> +
-<link rel="start" href="/"/> +
-<link rel="contents" href="/user/project_template?do=index" title="Sitemap"/> +
-<link rel="alternate" type="application/rss+xml" title="Recent changes" href="/feed.php"/> +
-<link rel="alternate" type="application/rss+xml" title="Current namespace" href="/feed.php?mode=list&amp;ns=user"/> +
-<link rel="alternate" type="text/html" title="Plain HTML" href="/_export/xhtml/user/project_template"/> +
-<link rel="alternate" type="text/plain" title="Wiki Markup" href="/_export/raw/user/project_template"/> +
-<link rel="canonical" href="http://lab46.corning-cc.edu/user/project_template"/> +
-<link rel="stylesheet" type="text/css" href="/lib/exe/css.php?t=lab46&amp;tseed=fe5600f7e90199fdf4471f7ef0db27b4"/> +
-<script type="text/javascript">/*<![CDATA[*/var NS='user';var SIG=' --- //[[|Alana]] 2014/03/09 11:16//';var JSINFO = {"id":"user:project_template","namespace":"user"}; +
-/*!]]>*/</script> +
-<script type="text/javascript" charset="utf-8" src="/lib/exe/js.php?tseed=fe5600f7e90199fdf4471f7ef0db27b4"></script> +
-    <meta name="viewport" content="width=device-width,initial-scale=1" /> +
-    <link rel="shortcut icon" href="/lib/tpl/lab46/images/favicon.ico" /> +
-<link rel="apple-touch-icon" href="/lib/tpl/lab46/images/apple-touch-icon.png" /> +
-    </head>+
  
-<body> +A project for C/C++ programming, CSCS1320S14, by Alana Whittier during the Spring semester 2014.
-    <!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]--> +
-    <div id="dokuwiki__site"><div id="dokuwiki__top" class="site dokuwiki mode_show tpl_lab46 loggedIn   showSidebar hasSidebar">+
  
-         +This project was begun on March 7, 2014 and it took nearly 3 days to complete.  
-<!-- ********** HEADER ********** --> +=====Objectives===== 
-<div id="dokuwiki__header"><div class="pad group"> +The purpose of this project is to write a program that utilizes a mental math trick to determine what day of the week that January 1st of any given year falls on in the 21st century. A two digit year (between 2001 and 2099is input from the user and is computed using series of selection statements to derive the day of the week that Jan 1st falls on per calendar year, minus one day for leap years.   
- +=====Prerequisites=====
-     +
-    <div class="headings group"> +
-        <ul class="a11y skip"> +
-            <li><a href="#dokuwiki__content">skip to content</a></li> +
-        </ul> +
- +
-        <h1><a href="/start"  accesskey="h" title="[H]"><img src="/_media/wiki/lab46logo.png" width="125" height="65" alt="" /> <span>Lab46 Wiki</span></a></h1> +
-            </div> +
- +
-    <div class="tools group"> +
-        <!-- USER TOOLS --> +
-                    <div id="dokuwiki__usertools"> +
-                <h3 class="a11y">User Tools</h3> +
-                <ul> +
-                    <li class="user">Logged in as: <bdi>Alana</bdi> (<bdi>acrowle1</bdi>)</li><li><a href="/user/project_template?do=logout&amp;sectok=c8b2175abe543850ce279cff7ff3f8b2"  class="action logout" rel="nofollow" title="Logout">Logout</a></li>                </ul> +
-            </div> +
-         +
-        <!-- SITE TOOLS --> +
-        <div id="dokuwiki__sitetools"> +
-            <h3 class="a11y">Site Tools</h3> +
-            <form action="/start" accept-charset="utf-8" class="search" id="dw__search" method="get" role="search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" class="edit" title="[F]" /><input type="submit" value="Search" class="button" title="Search" /><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>            <div class="mobileTools"> +
-                <form action="/doku.php" method="get" accept-charset="utf-8"><div class="no"><input type="hidden" name="id" value="user:project_template" /><input type="hidden" name="sectok" value="c8b2175abe543850ce279cff7ff3f8b2" /><select name="do" class="edit quickselect" title="Tools"><option value="">Tools</option><optgroup label="Page Tools"><option value="edit">Show pagesource</option><option value="revisions">Old revisions</option><option value="backlink">Backlinks</option><option value="subscribe">Manage Subscriptions</option></optgroup><optgroup label="Site Tools"><option value="recent">Recent changes</option><option value="media">Media Manager</option><option value="index">Sitemap</option></optgroup><optgroup label="User Tools"><option value="logout">Logout</option></optgroup></select><input type="submit" value="&gt;" /></div></form>            </div> +
-            <ul> +
-                <li><a href="/user/project_template?do=recent"  class="action recent" accesskey="r" rel="nofollow" title="Recent changes [R]">Recent changes</a></li><li><a href="/user/project_template?do=media&amp;ns=user"  class="action media" rel="nofollow" title="Media Manager">Media Manager</a></li><li><a href="/user/project_template?do=index"  class="action index" accesskey="x" rel="nofollow" title="Sitemap [X]">Sitemap</a></li>            </ul> +
-        </div> +
- +
-    </div> +
- +
-    <!-- BREADCRUMBS --> +
-            <div class="breadcrumbs"> +
-                            <div class="youarehere"><span class="bchead">You are here: </span><span class="home"><bdi><a href="/start" class="wikilink1" title="start">start</a></bdi></span> » <bdi><a href="/user/start" class="wikilink1" title="user:start">user</a></bdi> » <bdi><span class="curid"><a href="/user/project_template" class="wikilink1" title="user:project_template">project_template</a></span></bdi></div> +
-                                </div> +
-     +
-     +
-    <hr class="a11y" /> +
-</div></div><!-- /header --> +
- +
-        <div class="wrapper group"> +
- +
-                            <!-- ********** ASIDE ********** --> +
-                <div id="dokuwiki__aside"><div class="pad include group"> +
-                    <h3 class="toggle">Sidebar</h3> +
-                    <div class="content"> +
-                                                                        <!-- EDIT1 PLUGIN_WRAP_START [0-] --><div class="wrap_round wrap_box plugin_wrap"><!-- EDIT3 PLUGIN_INCLUDE_START "user:acrowle1:sidebar" [0-] --><div class="plugin_include_content plugin_include__user:acrowle1:sidebar" id="plugin_include__user__acrowle1__sidebar"> +
- +
-<p> +
-<em class="u">content</em> +
-</p> +
-<ul> +
-<li class="level1"><div class="li"> <a href="/user/acrowle1/start" class="wikilink2" title="user:acrowle1:start" rel="nofollow">Wiki Page</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/opus/spring2014/acrowle1/start" class="wikilink1" title="opus:spring2014:acrowle1:start">Opus</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/user/acrowle1/portfolio" class="wikilink1" title="user:acrowle1:portfolio">Portfolio</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/hg/user/acrowle1/" class="wikilink1" title="/hg/user/acrowle1/">Repository</a></div> +
-</li> +
-</ul> +
-<!-- EDIT5 PLUGIN_INCLUDE_START "user:acrowle1:courses" [0-] --><div class="plugin_include_content plugin_include__user:acrowle1:courses" id="plugin_include__user__acrowle1__courses"> +
- +
-<p> +
-<em class="u">courses</em> +
-</p> +
-<ul> +
-<li class="level1"><div class="li"> <a href="/haas/spring2014/cprog" class="wikilink1" title="/haas/spring2014/cprog">CSCS1320 cprog</a></div> +
-</li> +
-</ul> +
-<!-- EDIT6 PLUGIN_INCLUDE_END "user:acrowle1:courses" [0-] --></div> +
-<!-- EDIT4 PLUGIN_INCLUDE_END "user:acrowle1:sidebar" [0-] --></div> +
- +
-<p> +
-<em class="u">information</em> +
-</p> +
-<ul> +
-<li class="level1"><div class="li"> <a href="/documentation/start" class="wikilink1" title="documentation:start">Documentation</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/facultypages" class="wikilink1" title="facultypages">Faculty Pages</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/logstatus" class="wikilink1" title="logstatus">Log Metrics</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/mailinglists" class="wikilink1" title="mailinglists">Mailing Lists</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/user/start" class="wikilink1" title="user:start">Student Pages</a></div> +
-</li> +
-</ul> +
- +
-<p> +
-<em class="u">support</em> +
-</p> +
-<ul> +
-<li class="level1"><div class="li"> <a href="/administrivia" class="wikilink1" title="administrivia">Administrivia</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/help_request" class="wikilink1" title="help_request">Submit a Help Request</a></div> +
-</li> +
-<li class="level1"><div class="li"> <a href="/tutorcentral" class="wikilink1" title="tutorcentral">Tutoring Help</a></div> +
-</li> +
-</ul> +
-</div><!-- EDIT2 PLUGIN_WRAP_END [0-] -->                                            </div> +
-                </div></div><!-- /aside --> +
-             +
-            <!-- ********** CONTENT ********** --> +
-            <div id="dokuwiki__content"><div class="pad group"> +
- +
-                <div class="pageId"><span>user:project_template</span></div> +
- +
-                <div class="page group"> +
-                                                            <!-- wikipage start --> +
-                    <!-- TOC START --> +
-<div id="dw__toc"> +
-<h3 class="toggle">Table of Contents</h3> +
-<div> +
- +
-<ul class="toc"> +
-<li class="level1"><div class="li"><a href="#projectyour_project_name_here">Project: YOUR PROJECT NAME HERE</a></div> +
-<ul class="toc"> +
-<li class="level2"><div class="li"><a href="#objectives">Objectives</a></div></li> +
-<li class="level2"><div class="li"><a href="#prerequisites">Prerequisites</a></div></li> +
-<li class="level2"><div class="li"><a href="#background">Background</a></div></li> +
-<li class="level2"><div class="li"><a href="#scope">Scope</a></div></li> +
-<li class="level2"><div class="li"><a href="#attributes">Attributes</a></div></li> +
-<li class="level2"><div class="li"><a href="#procedure">Procedure</a></div></li> +
-<li class="level2"><div class="li"><a href="#code">Code</a></div></li> +
-<li class="level2"><div class="li"><a href="#execution">Execution</a></div></li> +
-<li class="level2"><div class="li"><a href="#reflection">Reflection</a></div></li> +
-<li class="level2"><div class="li"><a href="#references">References</a></div></li> +
-</ul></li> +
-</ul> +
-</div> +
-</div> +
-<!-- TOC END --> +
- +
-<h1 class="sectionedit1" id="projectyour_project_name_here">Project: YOUR PROJECT NAME HERE</h1> +
-<div class="level1"> +
- +
-<p> +
-A project for COURSENAME by YOUR NAME OR GROUPMEMBER NAMES during the SEMESTER YEAR. +
-</p> +
- +
-<p> +
-This project was begun on DATE and is anticipated to take X AMOUNT OF TIME. (Upon completion you can correct this with the actual length). +
-</p> +
- +
-</div> +
- +
-<h2 class="sectionedit2" id="objectives">Objectives</h2> +
-<div class="level2"> +
- +
-<p> +
-State the purpose of this project. What is the point of this project? What do we hope to accomplish by undertaking it? +
-</p> +
- +
-</div> +
- +
-<h2 class="sectionedit3" id="prerequisites">Prerequisites</h2> +
-<div class="level2"> +
- +
-<p>+
 In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved: In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:
-</p> 
-<ul> 
-<li class="level1"><div class="li"> resource1</div> 
-</li> 
-<li class="level1"><div class="li"> resource2</div> 
-</li> 
-<li class="level1"><div class="li"> resource3</div> 
-</li> 
-<li class="level1"><div class="li"> experience1</div> 
-</li> 
-<li class="level1"><div class="li"> experience2</div> 
-</li> 
-<li class="level1"><div class="li"> etc.</div> 
-</li> 
-</ul> 
- 
-</div> 
- 
-<h2 class="sectionedit4" id="background">Background</h2> 
-<div class="level2"> 
- 
-<p> 
-State the idea or purpose of the project. What are you attempting to pursue? 
-</p> 
- 
-<p> 
-Upon approval, you&#039;ll want to fill this section out with more detailed background information. DO NOT JUST PROVIDE A LINK. 
-</p> 
- 
-<p> 
-Providing any links to original source material, such as from a project page, is a good idea. 
-</p> 
- 
-<p> 
-You&#039;ll want to give a general overview of what is going to be accomplished (for example, if your project is about installing a web server, do a little write-up on web servers. What is it, why do we need one, how does it work, etc.) 
-</p> 
- 
-</div> 
- 
-<h2 class="sectionedit5" id="scope">Scope</h2> 
-<div class="level2"> 
- 
-<p> 
-Give a general overview of your anticipated implementation of the project. Address any areas where you are making upfront assumptions or curtailing potential detail. State the focus you will be taking in implementation. 
-</p> 
- 
-</div> 
- 
-<h2 class="sectionedit6" id="attributes">Attributes</h2> 
-<div class="level2"> 
- 
-<p> 
-State and justify the attributes you&#039;d like to receive upon successful approval and completion of this project. 
-</p> 
-<ul> 
-<li class="level1"><div class="li"> attribute1: why you feel your pursuit of this project will gain you this attribute</div> 
-</li> 
-<li class="level1"><div class="li"> attribute2: why you feel your pursuit of this project will gain you this attribute</div> 
-</li> 
-<li class="level1"><div class="li"> etc…</div> 
-</li> 
-</ul> 
  
-</div>+**Resources:** 
 +  * http://vpcalendar.net/when-is-the-next-leap-year.html 
 +  * http://www.timeanddate.com/date/leapyear.html 
 +  * project assignment page 
 +  * consultation with C/C++ programming instructor, Matt Haas 
 +**Experiences:** 
 +  * ability to obtain user input 
 +  * ability to obtain the day of the week January 1st falls on per given year. 
 +  * ability to use selection statements to achieve desired result 
 +  * ability to use Bitwise && to distinguish between leap year and non-leap year 
 +=====Background===== 
 +The purpose of this project is to use a mental math technique to programmatically compute the day on which January 1st falls per given calendar year in the 21st century. The "mental math" trick is used to simplify the process of computation without being dependent on a calculator. To see how this particular technique works for computing the week day that January 1st falls on, see the assignment link below. 
 +[[haas:spring2014:cprog:projects:dayofweek|Project: MENTAL MATH (DAY OF WEEK)]] 
 +To implement the program to compile and execute successfully, it is required to know how to determine leap years from non-leap years. As we experience leap years as much as every four years, simple algorithms can be used to determine the leap year. However, every 100 years, a leap year is skipped to make up for the 11 minutes removed from the 365.25 day calendar year.  
  
-<h2 class="sectionedit7" id="procedure">Procedure</h2> +=====Scope===== 
-<div class="level2">+The scope of the project is to write a program that utilizes the described mental math technique (see assignment in Background section above) to compute the week day that January 1st happens to fall on for a given year in the 21st century (2000-2099). In doing so, the program should prompt the user for the last two digits of the year, perform the calculation of the day of the week that January 1st falls on for the year given by user input, and display the value. Applying pointers to enable the use of scanf() for obtaining input from the user, using if() statements, are used in the implementation of this program.  
 +=====Attributes===== 
 + Upon successful completion of this project, the following attributes are achieved.
  
-<p>+  * More familiarity with pointers and scanf: This project requires user input. 
 +  * Become more exposed to selection statements: if statements are used to compute the day of the week January 1st falls on per given calendar year. 
 +  * Get more comfortable with Bitwise && operators: used to differentiate between leap years and non-leap years to obtain the correct output. 
 +=====Procedure=====
 The actual steps taken to accomplish the project. Include images, code snippets, command-line excerpts; whatever is useful for intuitively communicating important information for accomplishing the project. The actual steps taken to accomplish the project. Include images, code snippets, command-line excerpts; whatever is useful for intuitively communicating important information for accomplishing the project.
-</p> 
  
-</div>+=====Code===== 
 +</code> 
 +/*dayofweek.c- A program using a math technique to output the day of the week; 
 +               that January 1st falls on from calender years 2001 to 2099 based; 
 +               on what year the user inputs;
  
-<h2 class="sectionedit8" id="code">Code</h2> +A C program Written by: Alana Whittier for CSCS1320S14 on March 7, 2014; 
-<div class="level2">+*/
  
-<p> +#include <stdio.h> 
-Upon completion of the project, if there is an applicable collection of created code, place a copy of your finished code within &lt;code&gt; &lt;/code&gt; blocks here. +#include <stdlib.h>
-</p> +
-<pre class="c code c"><span class="coMULTI">/+
- * hello.c - A sample &quot;Hello, World!&quot; program +
- * +
- * written by NAME for COURSE on DATE +
- * +
- * compile with: +
-   gcc -o hello hello.c +
- * +
- * execute with: +
-   ./hello +
- */</span> +
-&nbsp; +
-<span class="co2">#include &lt;stdio.h&gt;</span+
-&nbsp; +
-<span class="kw4">int</span> main<span class="br0">&#40;</span><span class="br0">&#41;</span> +
-<span class="br0">&#123;</span> +
-    <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span class="kw3">printf</span></a><span class="br0">&#40;</span><span class="st0">&quot;Hello, World!<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>    <span class="co1">// Output message to STDOUT</span> +
-    <span class="kw1">return</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span> +
-<span class="br0">&#125;</span></pre> +
-</div>+
  
-<h2 class="sectionedit9" id="execution">Execution</h2> +int main() 
-<div class="level2">+{
  
-<p+int i; 
-Again, if there is associated code with the project, and you haven&#039;t already indicated how to run it, provide a sample run of your code: +int *p; 
-</p+p=&i; 
-<pre class="cli"><span class="cli_prompt">lab46:~/src/cprog$ </span><span class="cli_command">./hello</span> +int year;
-<span class="cli_output">Hello, World!</span> +
-<span class="cli_prompt">lab46:~/src/cprog$ </span><span class="cli_command"></span> +
-</pre> +
-</div>+
  
-<h2 class="sectionedit10" id="reflection">Reflection</h2> 
-<div class="level2"> 
  
-<p> 
-Comments/thoughts generated through performing the project, observations made, analysis rendered, conclusions wrought. What did you learn from doing this project? 
-</p> 
  
-</div>+printf("Type last two digits of year from 2001-2099;\n"); 
 +scanf("%d", p);
  
-<h2 class="sectionedit11" id="references">References</h2> +year=i; 
-<div class="level2">+i=(float)(((i/2)/2)); 
 +i=(year+i)%7;
  
-<p> 
-In performing this project, the following resources were referenced: 
-</p> 
-<ul> 
-<li class="level1"><div class="li"> URL1</div> 
-</li> 
-<li class="level1"><div class="li"> URL2</div> 
-</li> 
-<li class="level1"><div class="li"> URL3 (provides useful information on topic)</div> 
-</li> 
-<li class="level1"><div class="li"> URL4</div> 
-</li> 
-</ul> 
  
-<p> +//leap years! 
-Generallystate where you got informative and useful information to help you accomplish this project when you originally worked on it (from Googleother wiki documents on the Lab46 wikietc.+if(year%4==0&&(year/4!=0)){ 
-</p>+        printf("year%d, is a leap year\n",2000+ year);} 
 +   if(i==1&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st,%d, is on : Sunday\n", 2000+ year);} 
 +   if(i==2&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st%d, is on: Monday\n"2000+year);} 
 +   if(i==3&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st, %d, is on: Tuesday\n", 2000+year);
 +   if(i==4&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st, %d, is on: Wednesday\n", 2000+year);
 +   if(i==5&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st, %d, is on: Thursday\n", 2000+year);
 +   if(i==6&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st, %d, is on: Friday\n", 2000+year);
 +   if(i==7&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st, %d, is on Saturday\n", 2000+year);
 +   if(i==0&&(year%4==0&&(year/4!=0))){ 
 +        printf("Jan 1st, %d, is on Saturday\n", 2000+year);}
  
-</div> 
  
-                    <!-- wikipage stop --> +//not leap years
-                                    </div>+    else if(i==1&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Monday\n", 2000+year);
 +    else if(i==2&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Tuesday\n", 2000+year);
 +    else if(i==3&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Wednesday\n", 2000+year);
 +    else if(i==4&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Thursday\n", 2000+year);
 +    else if(i==5&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Friday\n", 2000+year);
 +    else if(i==6&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Saturday\n", 2000+year);
 +    else if(i==7&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Sunday\n", 2000+year);
 +    else if(i==0&&(year%4!=0)){ 
 +        printf("Jan 1st, %d, is on: Sunday\n", 2000+year);}
  
-                <div class="docInfo"><bdi>user/project_template.txt</bdi> · Last modified: 2013/01/23 20:10 (external edit)</div>+return(0)
 +}
  
-                            </div></div><!-- /content --> 
  
-            <hr class="a11y" />+         
 +         
 +         
 +        
  
-            <!-- PAGE ACTIONS --> +</code>
-            <div id="dokuwiki__pagetools"> +
-                <h3 class="a11y">Page Tools</h3> +
-                <div class="tools"> +
-                    <ul> +
-                        <li><a href="/user/project_template?do=edit&amp;rev=0"  class="action source" accesskey="v" rel="nofollow" title="Show pagesource [V]"><span>Show pagesource</span></a></li><li><a href="/user/project_template?do=revisions"  class="action revs" accesskey="o" rel="nofollow" title="Old revisions [O]"><span>Old revisions</span></a></li><li><a href="/user/project_template?do=backlink"  class="action backlink" rel="nofollow" title="Backlinks"><span>Backlinks</span></a></li><li><a href="/user/project_template?do=subscribe"  class="action subscribe" rel="nofollow" title="Manage Subscriptions"><span>Manage Subscriptions</span></a></li><li><a href="#dokuwiki__top"  class="action top" accesskey="t" rel="nofollow" title="Back to top [T]"><span>Back to top</span></a></li>                    </ul> +
-                </div> +
-            </div> +
-        </div><!-- /wrapper -->+
  
-         +=====Execution=====
-<!-- ********** FOOTER ********** --> +
-<div id="dokuwiki__footer"><div class="pad"> +
-    <div class="license">Except where otherwise noted, content on this wiki is licensed under the following license: <bdi><a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license" class="urlextern">CC Attribution-Share Alike 3.0 Unported</a></bdi></div> +
-    <div class="buttons"> +
-        <a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license"><img src="/lib/images/license/button/cc-by-sa.png" alt="CC Attribution-Share Alike 3.0 Unported" /></a>        <a href="http://www.php.net" title="Powered by PHP" ><img +
-            src="/lib/tpl/lab46/images/button-php.gif" width="80" height="15" alt="Powered by PHP" /></a> +
-        <a href="http://validator.w3.org/check/referer" title="Valid HTML5" ><img +
-            src="/lib/tpl/lab46/images/button-html5.png" width="80" height="15" alt="Valid HTML5" /></a> +
-        <a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3" title="Valid CSS" ><img +
-            src="/lib/tpl/lab46/images/button-css.png" width="80" height="15" alt="Valid CSS" /></a> +
-        <a href="http://dokuwiki.org/" title="Driven by DokuWiki" ><img +
-            src="/lib/tpl/lab46/images/button-dw.png" width="80" height="15" alt="Driven by DokuWiki" /></a> +
-    </div> +
-</div></div><!-- /footer -->+
  
-    </div></div><!-- /site --> 
  
-    <div class="no"><img src="/lib/exe/indexer.php?id=user%3Aproject_template&amp;1394378161" width="2" height="1" alt="" /></div> +<cli> 
-    <div id="screen__mode" class="no"></div>    <!--[if ( lte IE | IE ) ]></div><![endif]--> +lab46:~/src/cscs1320$ nano dayofweek.c 
-</body> +lab46:~/src/cscs1320$ gcc -o dayofweek dayofweek.
-</html>+lab46:~/src/cscs1320$ ./dayofweek 
 +Type last two digits of year from 2001-2099; 
 +04 
 +year, 2004, is a leap year 
 +Jan 1st, 2004, is on: Thursday 
 +lab46:~/src/cscs1320$ cal 01 2004 
 +    January 2004 
 +Su Mo Tu We Th Fr Sa 
 +              2  3 
 +  5  6    9 10 
 +11 12 13 14 15 16 17 
 +18 19 20 21 22 23 24 
 +25 26 27 28 29 30 31
  
-  +lab46:~/src/cscs1320$ ./dayofweek 
-portfolio » cprogproject4 +Type last two digits of year from 2001-2099; 
- +67 
---------------------------------------------------------------------------------+Jan 1st, 2067, is on: Saturday 
 +lab46:~/src/cscs1320$ cal 01 2067 
 +    January 2067 
 +Su Mo Tu We Th Fr Sa 
 +                   1 
 +  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
  
 +</cli>
  
 +=====Reflection=====
 +Interestingly enough, the year 2000 would not be a leap year if only using the first 2 criteria. 
 +The criteria: 
 +  - If year is evenly divisible by 4, it is a leap year.
 +  - If year is evenly divided by 100, it is not a leap year, except when 
 +  - the year is also evenly divisible by 400.
  
 +The year 2000 is a significant calendar year because it was the first instance when the third criteria was invoked since switching from the Julian calendar to the Gregorian one. The reason for leap years? This was necessary to keep our calendar in alignment with Earth's revolutions around the sun. If we did not add a day to our calendar ~every 4 years, we would lose nearly 6 hours every year, so after 100 years our calendar would be off by nearly 24 days as measured by earth's revolutions. Why is a leap year skipped every 100 years, except in special instances (like year 2000)? This is to account for the 11 minutes shaved off from the 365.25 calendar year. 
  
 +While I wrote my code more simplistically saying if i divided by 4 equals zero, then it is a leap year and if i divided by 4 does not equal zero, not a leap year, the code worked. I could have added that i/100==0 || i/400==0 is a leap year to make my code more realistic to how the calendar interprets leap years from non-leap years, particularly in special instances such as 2000.
 +=====References=====
 +In performing this project, the following resources were referenced:
  
 +  * http://www.timeanddate.com/date/leapyear.html
 +  * http://vpcalendar.net/when-is-the-next-leap-year.html
 +  * [[haas:spring2014:cprog:projects:dayofweek|Project: MENTAL MATH (DAY OF WEEK)]]
  
  
user/acrowle1/portfolio/cprogproject4.1394378476.txt.gz · Last modified: 2014/03/09 15:21 by acrowle1