SE250:lab-1:hals016

From Marks Wiki
Jump to navigation Jump to search

SE250-Lab1

I started off the lab by trying to remember the syntax and trying to learn how to use the clock() function. After working on the code I realised that I had to record the time before the for-loop addition process and also the time after the process. Then to subtract the initial time from the final time.

One mistake I had was putting a "clock()" inside the for-loop as well as the other initial and final "clock()" recordings.

I think this will give me the time it takes for the addition process (done about a million times). When I made the process run a million times, I had the numbers 8 and 9 being displayed most of the time. I think this is 0.08 or 0.09 seconds of time that the process needed to run a million times.

Then I tried running the process 100 million times the time it took ranged from 850-950 which I am assuming to be just under a second.

One thing I had to do, because of using Microsoft Visual Studio 2008, was to add a scanf function at the end of the code to allow MS-DOS to stay open after everything has been executed.