<?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%3Arthu009</id>
	<title>SE250:lab-1:rthu009 - 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%3Arthu009"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:rthu009&amp;action=history"/>
	<updated>2026-04-28T18:26:06Z</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:rthu009&amp;diff=4452&amp;oldid=prev</id>
		<title>Mark: 12 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-1:rthu009&amp;diff=4452&amp;oldid=prev"/>
		<updated>2008-11-03T05:18:43Z</updated>

		<summary type="html">&lt;p&gt;12 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Lab1 rthu009 ==&lt;br /&gt;
&lt;br /&gt;
This lab is pretty easy but it requires having knowledge of using the time.h function. I learnt to use this function by looking through the help content that given in Visual C++ program. I found the information very use full and manage to apply the information successfully creating this time calculation program. &lt;br /&gt;
&lt;br /&gt;
This program uses a simple while loop to add numbers from 0 to 1000000000 one by one.  E.g.  (0+1=1, 1+1=2 etc up to 1000000000) the number 1000000000 was used to obtain a reasonable time values from the clock signals. I have tried calculating the values up to 100 or 1000 but the computer calculates these values fast which is less than a second long. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Running the program: Step1 ==&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;time.h&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 int main(void) {&lt;br /&gt;
 .&lt;br /&gt;
 int i=0;&lt;br /&gt;
 clock_t start, finish;&lt;br /&gt;
 double  duration;&lt;br /&gt;
 .&lt;br /&gt;
 start = clock();&lt;br /&gt;
 .&lt;br /&gt;
 while(i&amp;lt;=1000000000){&lt;br /&gt;
 .	i=i+1;&lt;br /&gt;
 }&lt;br /&gt;
 finish = clock();&lt;br /&gt;
 duration = (double)(finish - start) / CLOCKS_PER_SEC;&lt;br /&gt;
 printf(&amp;quot;Time taken to add 0 to 1000000000 by one is:  &amp;quot;);&lt;br /&gt;
 printf( &amp;quot;%2.1f seconds\n&amp;quot;, duration );&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Program output ==&lt;br /&gt;
&lt;br /&gt;
 Time taken to add 0 to 1000000000 by one is: 2.4 seconds&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running the same program for the &amp;#039;&amp;#039;Double&amp;#039;&amp;#039; ==&lt;br /&gt;
&lt;br /&gt;
When I run this program converting the “i” incrementing value from “int” to “double” I found that the time taken to process the calculation was longer. This is because the double value uses far more characters in its calculations than int’s rounded whole number figures.  &lt;br /&gt;
&lt;br /&gt;
 Time taken to add 0 to 1000000000 by one is: 9.5 seconds&lt;br /&gt;
&lt;br /&gt;
This shows significant increase in time.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>