<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-1%3Asbas046</id>
	<title>SE250:lab-1:sbas046 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-1%3Asbas046"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:sbas046&amp;action=history"/>
	<updated>2026-04-24T13:41:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-1:sbas046&amp;diff=4480&amp;oldid=prev</id>
		<title>Mark: 1 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:sbas046&amp;diff=4480&amp;oldid=prev"/>
		<updated>2008-11-03T05:18:44Z</updated>

		<summary type="html">&lt;p&gt;1 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;SOFTENG 250 – LAB 1&lt;br /&gt;
4500567&lt;br /&gt;
----&lt;br /&gt;
I started by reading the Task Sheet at which point I realized I didn’t remember anything about C.&lt;br /&gt;
I started Visual Studios.&lt;br /&gt;
I had problems figuring out how to start a project in Visual Studios and finally got it through trial and error.&lt;br /&gt;
I then decided that Visual Basics was too complicated and decided to try use emacs.  After loading emacs however I promptly reassessed my hasty decision and and went back to using Visual Studio.&lt;br /&gt;
It took me a while to get started as recalling even the basic commands seemed beyond my ability.&lt;br /&gt;
I finally wrote something that resembled a for-loop with an addition inside and two clock functions before and after it. This was done with significant use of the Visual Studios help files as well as the internet.&lt;br /&gt;
The first time I compiled and ran it I got some minor syntax errors which I fixed.&lt;br /&gt;
When it did run the answer that came up was 0. I figured out that this was because I was printing the time taken for each addition and the long variable does not support decimals.&lt;br /&gt;
I concluded that the way around it was to just print the time taken for a large number of calculations.&lt;br /&gt;
My program at this point looked like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
	long t, t1, tfinal;&lt;br /&gt;
	int i, number;&lt;br /&gt;
&lt;br /&gt;
	number = 100000000;&lt;br /&gt;
	t = clock();&lt;br /&gt;
&lt;br /&gt;
	for (i=0; i&amp;lt;number; i++)&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	t1= clock();&lt;br /&gt;
	tfinal = ((t1 - t));&lt;br /&gt;
	printf (&amp;quot;The time taken %d for addition is %ld clicks\n&amp;quot;, number, tfinal);&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This was 1 and a half hours of work. I was very proud.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The next was to modify the program so that it calculated the time taken for the calculation excluding the time taken for the loop. I did this my performing two loops and timing both. One of the loops included an addition calculation. I then subtracted the time taken for only the loop from the time for loop and the addition. This gave me a time for addition independent of the time taken for the loop.&lt;br /&gt;
My final program was as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
	long t, t1, t2, t3, tfinal;&lt;br /&gt;
	int i, number;&lt;br /&gt;
&lt;br /&gt;
	number = 100000000;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	t = clock();&lt;br /&gt;
	for (i=0; i&amp;lt;number; i++)&lt;br /&gt;
	{&lt;br /&gt;
		i++;&lt;br /&gt;
	}&lt;br /&gt;
	t1= clock();&lt;br /&gt;
&lt;br /&gt;
	t2 = clock();&lt;br /&gt;
	for (i=0; i&amp;lt;number; i++)&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
	t3= clock();&lt;br /&gt;
&lt;br /&gt;
	tfinal = ((t1 - t)) - ((t2 - t3)) ;&lt;br /&gt;
	printf (&amp;quot;The time taken for %d addition calculations is %ld\n&amp;quot;, number, tfinal);&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I concluded from this lab task that I need to recap on what I learnt last year.&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>