Advertisement
Guest User

przedzialy czasowe

a guest
Oct 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. class MainClass {
  2. static void wieksze(){
  3. TimeSpan tod = DateTime.Now.TimeOfDay;
  4. int nowMins = (int)tod.TotalMinutes;
  5. string [] hs = new string[]{"21:24","14:25","13:67","23:24"};
  6. for(int i =0;i<hs.Length;i++){
  7. string h = hs[i];
  8. // Console.WriteLine(h.Substring(0,2));
  9. // Console.WriteLine(h.Substring(3,2));
  10. int godzina = Convert.ToInt32(h.Substring(0,2));
  11. int minuta = Convert.ToInt32(h.Substring(3,2));
  12. int lateMins = godzina * 60 + minuta;
  13.  
  14. if (nowMins >= lateMins)
  15. {
  16. Console.WriteLine("LATE");
  17. }
  18. else
  19. {
  20. Console.WriteLine("ON TIME");
  21. }
  22. }
  23. }
  24. public static void Main (string[] args) {
  25. Console.WriteLine ("Hello World");
  26. wieksze();
  27.  
  28.  
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement