Advertisement
Guest User

Untitled

a guest
Jun 26th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. using System.IO;
  7.  
  8. namespace ConsoleApplication4
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string[] lines = File.ReadAllLines("LapTimes.txt");
  15.             double currentLapStartTime = 0;
  16.             double fastestLapTime = 0;
  17.             foreach (string line in lines)
  18.             {
  19.                 double lapEndTime = double.Parse(line);
  20.                 double lapTime = lapEndTime - currentLapStartTime;
  21.                 if (fastestLapTime == 0 || lapTime < fastestLapTime)
  22.                 {
  23.                     fastestLapTime = lapTime;
  24.                 }
  25.                 currentLapStartTime = lapEndTime;
  26.             }
  27.             Console.WriteLine("Czas najszybszego okrazenia: " + fastestLapTime);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement