Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Globalization;
- namespace _10.BeerTime
- {
- class BeerTime
- {
- static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- string format = "hh:mm tt";
- string wishTime = Console.ReadLine();
- string startTime = "01:00 PM";
- string endTime = "03:00 AM";
- DateTime wish = DateTime.ParseExact(wishTime, format, CultureInfo.InvariantCulture);
- DateTime startBeerTime = DateTime.ParseExact(startTime, format, CultureInfo.InvariantCulture);
- DateTime endBeerTime = DateTime.ParseExact(endTime, format, CultureInfo.InvariantCulture);
- if ((wish > startBeerTime) && (wish < endBeerTime))
- {
- Console.WriteLine("beer time!");
- }
- else
- {
- Console.WriteLine("non beer!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment