Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
Vorlesung
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Albrecht - Prog1
WS2024
Vorlesung
Commits
4a0f9b85
Commit
4a0f9b85
authored
5 months ago
by
Jens Albrecht
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
4d3da102
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
VL250113_TryParse/TryParse.cs
+4
-2
4 additions, 2 deletions
VL250113_TryParse/TryParse.cs
with
4 additions
and
2 deletions
VL250113_TryParse/TryParse.cs
+
4
−
2
View file @
4a0f9b85
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
}
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment