Guest User

Untitled

a guest
Mar 1st, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Globalization;
  7.  
  8. namespace _10.BeerTime
  9. {
  10. class BeerTime
  11. {
  12. static void Main()
  13. {
  14. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  15. string format = "hh:mm tt";
  16. string wishTime = Console.ReadLine();
  17. string startTime = "01:00 PM";
  18. string endTime = "03:00 AM";
  19. DateTime wish = DateTime.ParseExact(wishTime, format, CultureInfo.InvariantCulture);
  20. DateTime startBeerTime = DateTime.ParseExact(startTime, format, CultureInfo.InvariantCulture);
  21. DateTime endBeerTime = DateTime.ParseExact(endTime, format, CultureInfo.InvariantCulture);
  22. if ((wish > startBeerTime) && (wish < endBeerTime))
  23. {
  24. Console.WriteLine("beer time!");
  25. }
  26. else
  27. {
  28. Console.WriteLine("non beer!");
  29. }
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment