Diff
checker
Text
Text
Bilder
Dokumente
Excel
Ordner
Legal
Enterprise
Desktop-App
Preise
Einloggen
Diffchecker Desktop herunterladen
Texte vergleichen
Finde den Unterschied zwischen zwei Textdateien
Werkzeuge
Verlauf
Live-Editor
Gleiches ausblenden
Zeilenumbruch aus
Ansicht
Zweispaltig
Einspaltig
Vergleichsgenauigkeit
Intelligent
Wort
Zeichen
Syntaxhervorhebung
Syntax auswählen
Ignorieren
Text umwandeln
Zur ersten Änderung
Eingabe bearbeiten
Diffchecker Desktop
Der sicherste Weg, Diffchecker zu nutzen. Hol dir die Desktop-App: Deine Diffs verlassen nie deinen Computer!
Desktop holen
Diff
Erstellt
vor 3 Jahren
Diff läuft nie ab
Löschen
Exportieren
Teilen
Erklären
8 Entfernungen
Zeilen
Gesamt
Entfernt
Zeichen
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
45 Zeilen
Kopieren
41 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Zeichen
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
78 Zeilen
Kopieren
using System;
using System;
using System.Net.Http;
using System.Net.Http;
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace CurrencyExchange
namespace CurrencyExchange
{
{
class Program
class Program
{
{
static void Main(string[] args)
static void Main(string[] args)
{
{
Kopieren
Kopiert
Kopieren
Kopiert
// Get the amount to convert and the currency codes
Console.WriteLine("Enter the amount you want to convert: ");
Console.WriteLine("Enter the amount you want to convert: ");
Kopieren
Kopiert
Kopieren
Kopiert
string amountString = Console.ReadLine();
double amount = GetInputAmount();
double amount = double.Parse(amountString);
string fromCurrency =
GetCurrencyCode("FROM");
string toCurrency =
GetCurrencyCode("TO"
);
Console.WriteLine("Enter the currency code of the currency you want to convert FROM: ");
string fromCurrency =
Console.ReadLine();
Console.WriteLine("Enter the currency code of the currency you want to convert TO: ");
string toCurrency =
Console.ReadLine(
);
Kopieren
Kopiert
Kopieren
Kopiert
// Get the exchange rate and convert the amount
double exchangeRate = GetExchangeRate(fromCurrency, toCurrency).Result;
double exchangeRate = GetExchangeRate(fromCurrency, toCurrency).Result;
double convertedAmount = exchangeRate * amount;
double convertedAmount = exchangeRate * amount;
Console.WriteLine($"{amount} {fromCurrency} is equal to {convertedAmount} {toCurrency}");
Console.WriteLine($"{amount} {fromCurrency} is equal to {convertedAmount} {toCurrency}");
}
}
static async Task<double> GetExchangeRate(string fromCurrency, string toCurrency)
static async Task<double> GetExchangeRate(string fromCurrency, string toCurrency)
{
{
string apiKey = "your-api-key-here";
string apiKey = "your-api-key-here";
string apiUrl = $"https://api.exchangerate-api.com/v4/latest/{fromCurrency}";
string apiUrl = $"https://api.exchangerate-api.com/v4/latest/{fromCurrency}";
HttpClient client = new HttpClient();
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", apiKey);
client.DefaultRequestHeaders.Add("Authorization", apiKey);
HttpResponseMessage response = await client.GetAsync(apiUrl);
HttpResponseMessage response = await client.GetAsync(apiUrl);
string result = await response.Content.ReadAsStringAsync();
string result = await response.Content.ReadAsStringAsync();
// Parse the exchange rate from the JSON response
// Parse the exchange rate from the JSON response
dynamic exchangeRates = JsonConvert.DeserializeObject(result);
dynamic exchangeRates = JsonConvert.DeserializeObject(result);
double exchangeRate = exchangeRates.rates[toCurrency];
double exchangeRate = exchangeRates.rates[toCurrency];
return exchangeRate;
return exchangeRate;
}
}
Kopieren
Kopiert
Kopieren
Kopiert
static double GetInputAmount()
{
double amount = 0;
bool validInput = false;
while (!validInput)
{
string amountString = Console.ReadLine();
if (double.TryParse(amountString, out amount))
{
validInput = true;
}
else
{
Console.WriteLine("Invalid input. Please enter a valid amount: ");
}
}
return amount;
}
static string GetCurrencyCode(string currencyType)
{
Console.WriteLine($"Enter the currency code of the currency you want to convert {currencyType}: ");
string currencyCode = Console.ReadLine().ToUpper();
// Validate the currency code
if (currencyCode.Length != 3)
{
Console.WriteLine("Invalid currency code. Please enter a valid 3-letter currency code: ");
return GetCurrencyCode(currencyType);
}
return currencyCode;
}
}
}
}
}
Gespeicherte Diffs
Originaltext
Datei öffnen
using System; using System.Net.Http; using System.Threading.Tasks; namespace CurrencyExchange { class Program { static void Main(string[] args) { Console.WriteLine("Enter the amount you want to convert: "); string amountString = Console.ReadLine(); double amount = double.Parse(amountString); Console.WriteLine("Enter the currency code of the currency you want to convert FROM: "); string fromCurrency = Console.ReadLine(); Console.WriteLine("Enter the currency code of the currency you want to convert TO: "); string toCurrency = Console.ReadLine(); double exchangeRate = GetExchangeRate(fromCurrency, toCurrency).Result; double convertedAmount = exchangeRate * amount; Console.WriteLine($"{amount} {fromCurrency} is equal to {convertedAmount} {toCurrency}"); } static async Task<double> GetExchangeRate(string fromCurrency, string toCurrency) { string apiKey = "your-api-key-here"; string apiUrl = $"https://api.exchangerate-api.com/v4/latest/{fromCurrency}"; HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", apiKey); HttpResponseMessage response = await client.GetAsync(apiUrl); string result = await response.Content.ReadAsStringAsync(); // Parse the exchange rate from the JSON response dynamic exchangeRates = JsonConvert.DeserializeObject(result); double exchangeRate = exchangeRates.rates[toCurrency]; return exchangeRate; } } }
Bearbeitung
Datei öffnen
using System; using System.Net.Http; using System.Threading.Tasks; namespace CurrencyExchange { class Program { static void Main(string[] args) { // Get the amount to convert and the currency codes Console.WriteLine("Enter the amount you want to convert: "); double amount = GetInputAmount(); string fromCurrency = GetCurrencyCode("FROM"); string toCurrency = GetCurrencyCode("TO"); // Get the exchange rate and convert the amount double exchangeRate = GetExchangeRate(fromCurrency, toCurrency).Result; double convertedAmount = exchangeRate * amount; Console.WriteLine($"{amount} {fromCurrency} is equal to {convertedAmount} {toCurrency}"); } static async Task<double> GetExchangeRate(string fromCurrency, string toCurrency) { string apiKey = "your-api-key-here"; string apiUrl = $"https://api.exchangerate-api.com/v4/latest/{fromCurrency}"; HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", apiKey); HttpResponseMessage response = await client.GetAsync(apiUrl); string result = await response.Content.ReadAsStringAsync(); // Parse the exchange rate from the JSON response dynamic exchangeRates = JsonConvert.DeserializeObject(result); double exchangeRate = exchangeRates.rates[toCurrency]; return exchangeRate; } static double GetInputAmount() { double amount = 0; bool validInput = false; while (!validInput) { string amountString = Console.ReadLine(); if (double.TryParse(amountString, out amount)) { validInput = true; } else { Console.WriteLine("Invalid input. Please enter a valid amount: "); } } return amount; } static string GetCurrencyCode(string currencyType) { Console.WriteLine($"Enter the currency code of the currency you want to convert {currencyType}: "); string currencyCode = Console.ReadLine().ToUpper(); // Validate the currency code if (currencyCode.Length != 3) { Console.WriteLine("Invalid currency code. Please enter a valid 3-letter currency code: "); return GetCurrencyCode(currencyType); } return currencyCode; } } }
Unterschied finden