Created
October 7, 2016 10:10
-
-
Save s0ren/e854ee550674c2b36807bd6be6b7f84e to your computer and use it in GitHub Desktop.
Opdeling af program med forskellige sprog
This file contains hidden or 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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace DanskEngelsk | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.Write("Dansk eller Engelsk? Tast D eller E: "); | |
string svar = Console.ReadLine(); | |
if (svar == "D") | |
{ | |
udskrivVejr("Dansk"); | |
} | |
else if (svar == "E") | |
{ | |
udskrivVejr("Engelsk"); | |
} | |
else | |
{ | |
Console.Write("Prøv igen: E/D "); | |
} | |
} | |
private static void udskrivVejr(string sprog) | |
{ | |
string weather = ""; | |
double temp = 0.0; | |
string prompt1 = ""; | |
string prompt2 = ""; | |
if (sprog == "Dansk") | |
{ | |
prompt1 = "Vejret i Danmark er"; | |
prompt2 = "Temperaturen lige nu er"; | |
weather = "dejligt"; | |
temp = 21.0; // I celius | |
} | |
else if (sprog == "Engelsk") | |
{ | |
prompt1 = "The weather i Denmark is"; | |
prompt2 = "Right now, the temperature is"; | |
weather = "lovely"; | |
temp = 64.0; // I farenheit | |
} | |
Console.WriteLine(prompt1 + " : " + weather); | |
Console.WriteLine("{1:S} : {0,6:N2}", temp, prompt2); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment