Skip to content
Snippets Groups Projects
Commit 4a0f9b85 authored by Jens Albrecht's avatar Jens Albrecht
Browse files

.

parent 4d3da102
Branches
No related tags found
No related merge requests found
class Program
{
// ConvertToInt oder IntParse
// Hier noch erweitert um die Basis des Zahlensystems.
// Funktioniert mit basis=2 oder 8 auch für Binär- und Oktalsystem
public static int IntParse(string text, int basis=10)
{
int ergebnis = 0;
......@@ -55,8 +57,8 @@
int zahl1 = IntParse("5432");
Console.WriteLine($"zahl1 = {zahl1}");
// int zahl2 = IntParse("54a3");
//Console.WriteLine($"zahl2 = {zahl2}");
int zahl2 = IntParse("1101", basis:2);
Console.WriteLine($"zahl2 = {zahl2}");
if (IntTryParse2("54a3", out int zahl3))
Console.WriteLine($"zahl3 = {zahl3}");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment