Created
March 13, 2011 17:42
-
-
Save DanielRapp/868283 to your computer and use it in GitHub Desktop.
homework v11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class MainClass | |
{ | |
static TimeSpan getTimeSec() { | |
Console.Write("Timme: "); | |
int hour = Int32.Parse(Console.ReadLine()); | |
Console.Write("Minut: "); | |
int min = Int32.Parse(Console.ReadLine()); | |
Console.Write("Sekund: "); | |
int sec = Int32.Parse(Console.ReadLine()); | |
return new TimeSpan(hour, min, sec); | |
} | |
public static void Main (string[] args) | |
{ | |
Console.WriteLine("Starttid:"); | |
TimeSpan startTime = getTimeSec(); | |
Console.WriteLine("Målgångstid:"); | |
TimeSpan endTime = getTimeSec(); | |
TimeSpan timeDiff = endTime.Subtract(startTime); | |
Console.WriteLine("Resultat: {0} tim {1} min {2} sek", | |
timeDiff.Hours, | |
timeDiff.Minutes, | |
timeDiff.Seconds); | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment