473,511 Members | 15,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

my modified timer program

Ok, I made some changes and want to see what you guys think, as far as
syntax and logic, etc. What I want it to do is show the number of
minutes remaining each minute, and then beep at the end. Is there a
better way to do the loops?

using System;
using System.Threading;

class Timer
{
static void Main()
{
Console.Write("Enter the number of minutes to wait: ");
int iTime = Int32.Parse(Console.ReadLine());

for (int i = iDelay; i > 0; i--)
{
Console.WriteLine("{0} minute(s) remaining.", i);
Thread.Sleep(60000);
}

Console.Write("{0} minutes have elapsed", iTime);

for (int i = 3; i > 0; i--)
{
Console.Write("\a");
Thread.Sleep(1000);
}
}
Nov 17 '05 #1
2 1299
So, what's iDelay? And what exactly is the use of this application?

-vj
"John Salerno" <jo******@NOSPAMgmail.com> wrote in message
news:dP********************@rcn.net...
Ok, I made some changes and want to see what you guys think, as far as
syntax and logic, etc. What I want it to do is show the number of minutes
remaining each minute, and then beep at the end. Is there a better way to
do the loops?

using System;
using System.Threading;

class Timer
{
static void Main()
{
Console.Write("Enter the number of minutes to wait: ");
int iTime = Int32.Parse(Console.ReadLine());

for (int i = iDelay; i > 0; i--)
{
Console.WriteLine("{0} minute(s) remaining.", i);
Thread.Sleep(60000);
}

Console.Write("{0} minutes have elapsed", iTime);

for (int i = 3; i > 0; i--)
{
Console.Write("\a");
Thread.Sleep(1000);
}
}

Nov 17 '05 #2
Vijaye Raji wrote:
So, what's iDelay? And what exactly is the use of this application?
Sorry, iDelay should be iTime. The point of the program is just for me
to experiment with writing code a little, but it's also a little alarm I
wanted to make.

-vj
"John Salerno" <jo******@NOSPAMgmail.com> wrote in message
news:dP********************@rcn.net...
Ok, I made some changes and want to see what you guys think, as far as
syntax and logic, etc. What I want it to do is show the number of minutes
remaining each minute, and then beep at the end. Is there a better way to
do the loops?

using System;
using System.Threading;

class Timer
{
static void Main()
{
Console.Write("Enter the number of minutes to wait: ");
int iTime = Int32.Parse(Console.ReadLine());

for (int i = iDelay; i > 0; i--)
{
Console.WriteLine("{0} minute(s) remaining.", i);
Thread.Sleep(60000);
}

Console.Write("{0} minutes have elapsed", iTime);

for (int i = 3; i > 0; i--)
{
Console.Write("\a");
Thread.Sleep(1000);
}
}


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1731
by: Djanvk | last post by:
Ok I'm working on a program where you have say x number of seconds to do something. I'm at a loss on how to go about running a timer function. Can anyone point me in the right direction or post a...
1
5655
by: martinm69x | last post by:
Hey all, I've been working on the code for a kernel timer which will report real time, CPU time, user time and kernel time on the operation of fibonacci method. The way im doing it is keeping...
8
2000
by: sm | last post by:
Hi All, I need to do a task at 3pm everyday. How do I set up the timer so that the timer procedure executes at 3pm everyday? Is there any other solution other than using a timer? Thanks.
1
1219
by: 180Reef | last post by:
I am new to using timers and am not sure which timer is best used for the timer driven vb program described below. Also, if I should use one master timer or a timer for each button (system resource...
2
2167
by: Greg | last post by:
I am building an SVG interface (with Javascript) for client side control of some hardware. The svg will be hosted on a micro PC (http://www.picotux.com/indexe.html). It runs a uClinux OS with GCC...
4
1892
by: Lemune | last post by:
Hello everyone. I'm using vb 2005. I'm creating program that run as service on windows. And in my program I need to use timer, so I'm using timer object from component. I try my source code on...
7
5944
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it...
9
2636
by: archana | last post by:
Hi all, I want to know about interval of timer. I am using timer in windows service.I head somewhere that when i set interval property of timer while setting interval, restart time of Pc is...
10
1820
by: Joris De Groote | last post by:
Hi, I have wrote a program that checks for files and moves these files to the correct folders when they come in. Everything works fine. However I always have to start that program manually. I...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
445
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.