my modified timer program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Salerno

    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.Threadin g;

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

    for (int i = iDelay; i > 0; i--)
    {
    Console.WriteLi ne("{0} minute(s) remaining.", i);
    Thread.Sleep(60 000);
    }

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

    for (int i = 3; i > 0; i--)
    {
    Console.Write(" \a");
    Thread.Sleep(10 00);
    }
    }
  • Vijaye Raji

    #2
    Re: my modified timer program

    So, what's iDelay? And what exactly is the use of this application?

    -vj
    "John Salerno" <johnjsal@NOSPA Mgmail.com> wrote in message
    news:dPmdnf4ys5 hqEh_fRVn-hQ@rcn.net...[color=blue]
    > 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.Threadin g;
    >
    > class Timer
    > {
    > static void Main()
    > {
    > Console.Write(" Enter the number of minutes to wait: ");
    > int iTime = Int32.Parse(Con sole.ReadLine() );
    >
    > for (int i = iDelay; i > 0; i--)
    > {
    > Console.WriteLi ne("{0} minute(s) remaining.", i);
    > Thread.Sleep(60 000);
    > }
    >
    > Console.Write(" {0} minutes have elapsed", iTime);
    >
    > for (int i = 3; i > 0; i--)
    > {
    > Console.Write(" \a");
    > Thread.Sleep(10 00);
    > }
    > }[/color]


    Comment

    • John Salerno

      #3
      Re: my modified timer program

      Vijaye Raji wrote:[color=blue]
      > So, what's iDelay? And what exactly is the use of this application?[/color]

      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.

      [color=blue]
      > -vj
      > "John Salerno" <johnjsal@NOSPA Mgmail.com> wrote in message
      > news:dPmdnf4ys5 hqEh_fRVn-hQ@rcn.net...
      >[color=green]
      >>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.Threadin g;
      >>
      >>class Timer
      >>{
      >> static void Main()
      >> {
      >> Console.Write(" Enter the number of minutes to wait: ");
      >> int iTime = Int32.Parse(Con sole.ReadLine() );
      >>
      >> for (int i = iDelay; i > 0; i--)
      >> {
      >> Console.WriteLi ne("{0} minute(s) remaining.", i);
      >> Thread.Sleep(60 000);
      >> }
      >>
      >> Console.Write(" {0} minutes have elapsed", iTime);
      >>
      >> for (int i = 3; i > 0; i--)
      >> {
      >> Console.Write(" \a");
      >> Thread.Sleep(10 00);
      >> }
      >>}[/color]
      >
      >
      >[/color]

      Comment

      Working...