Advertisement
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;
- Console.Write("Enter a time in format (hh:mm tt): ");
- 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 start = DateTime.ParseExact(startTime, format, CultureInfo.InvariantCulture);
- DateTime end = DateTime.ParseExact(endTime, format, CultureInfo.InvariantCulture);
- if ((wish > start) && (wish < end))
- {
- Console.WriteLine("YEEEEES! BEER TIME!!!");
- }
- else
- {
- Console.WriteLine("No beer for you! Keep studying!!!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement