All pastes #952136 Raw Edit

Untitled

public text v1 · immutable
#952136 ·published 2008-03-21 22:37 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input;
            int iostream;
            int moose;
            int hoursoffset = 8;
            bool donotquit = true;

            Console.WriteLine("************************************");
            Console.WriteLine("*  MooseTime v1.0.2                *");
            Console.WriteLine("*  by iostream                     *");
            Console.WriteLine("*                                  *");
            Console.WriteLine("*  Insert Q to quit                *");
            Console.WriteLine("************************************");
            while(donotquit)
            {
                bool isValidTime = false;

                do
                {

                Console.Write("\nPlease insert iostream's local time hour here:");
                input = Console.ReadLine();
                if (input.ToLower == "q")
                {
                    donotquit = false;
                    break;
                }

                isValidTime = int.TryParse(input, out iostream);

                } while ( !isValidTime );

                moose = iostream - hoursoffset;

                if (moose < 0)
                {
                    moose = (iostream + 24) - hoursoffset;
                }
                Console.WriteLine("iostream's time: " + iostream + "h");
                Console.WriteLine("Moose's time:    " + moose + "h");
            }
        }
    }
}