Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Timer
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Artimes




PostPosted: Thu Nov 06, 2003 10:29 pm   Post subject: Timer

This is a simple timer for all of you!

code:


% Timer
% Created by: John Baker
% Created on: November 5th, 2003
% This program is a timer that counts seconds, minutes, and hours

var seconds, minutes, hours : int := 0

    loop

        put "Time " : 5, hours : 2, ":", minutes : 2, ":", seconds : 2

        delay (1000)

        seconds := seconds + 1

        if seconds = 60 then

            seconds := 0

            minutes := minutes + 1

        elsif minutes = 60 then

            minutes := 0

            hours := hours + 1

        end if

        cls

    end loop

Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Fri Nov 07, 2003 5:19 pm   Post subject: (No subject)

this whould wrok alot better if you used turings time fuctions. that way it will be real time rather then dependedt on the speed of your computer.

ex.

code:

var startTime:int:=Time.Sec
var endTime:int:= 120 %put time in secondes to run
var curent:int

loop
    curent := Time.Sec  - startTime
   
    exit when curent >= endTime
end loop
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Artimes




PostPosted: Sat Nov 08, 2003 12:33 am   Post subject: (No subject)

Kewl, well I was just trying to show my skills some how...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: