Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Quelltext für Umrechnung von Dez in Binär

Empfohlene Antworten

Veröffentlicht

Hallo, ich brauche unbedingt hilfe mit dem Quelltext zur umrechnung von Dezimal in Binär und umgekehrt. Wer helfen kann, soll mir Bitte den Quelltext an Mojee@lycos.de schicken.

Danke und noch einen schönen Tag

Wie wär's, wenn du die Programmiersprache mit angibst?

Dann wirst du vielleicht geholfen.

Dezimal in Binär:

Feld=dez (modulo) 2

'den Rest einer Ganzzahl-Division in ein Array speichern

dez = dez (div) 2

'Die Ganzzahl vor Komma in die Variable speichern

Solange durchlaufen lassen, bis dez = 0 ist

Ich poste es lieber, da haben andere auch was davon.

Hier mal eine funktion in VB.

Public Function Dec2Bin(DezimalZahl As Long) As String

Dim BinZahl() As Integer

Dim Zahl As Long

Dim Stellen As Long

Dim Zaehler As Long

If DezimalZahl < 0 Then

Dec2Bin = "Fehler"

Exit Function

End If

If DezimalZahl = 0 Then

Dec2Bin = "0"

Exit Function

End If

Zahl = DezimalZahl

Stellen = 0

Do

Stellen = Stellen + 1

ReDim Preserve BinZahl(Stellen)

BinZahl(Stellen) = Zahl Mod 2

Zahl = (Zahl - BinZahl(Stellen)) / 2

Loop Until Zahl = 0

For Zaehler = Stellen To 1 Step -1

Dec2Bin = Dec2Bin & BinZahl(Zaehler)

Next

End Function

hiro

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.