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.

Batch - kleiner Rechner

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

ich habe gestern angefangen die Batch-Programmierung zu lernen und kenn mich daher nicht so gut aus...

Zu Beginn wollte ich einen kleinen Rechner machen, der Addition und Multiplikation beherrscht.

Doch das ganze will nicht so ganz klappen und besonders mit der ELSE hab ich so meine Probleme.

Könnt ihr mir vllt. helfen?

Hier der Quelltext:

@echo off

set /p name=Name eingeben:

IF "%name%"=="User" (

goto rechner

)

ELSE (

IF /I"%name%"!="User"

echo Sie sind nicht zugelassen!

exit

)

:rechner

set /p operation=Welche Rechenoperation wollen Sie anwenden?

IF "%operation%"=="Addition" (

goto addition

)

ELSE (

IF /I"%operation%"=="Multiplikation"

goto multiplikation

)

:addition

set /p addeins=1.Summand:

set /p addzwei=2.Summand:

set /a x=addeins+addzwei

echo Summe:%x%

echo.

echo.

goto addition

:multiplikation

set /p muleins=1.Faktor:

set /p mulzwei=2.Faktor:

set /a x=muleins*mulzwei

echo Produkt:%x%

echo.

echo.

goto multiplikation

MfG

  • Autor

Oh, hat sich alles geklärt :D

Ich hab etwas herumexperimentiert und hab meine Fehler bemerkt.

Hier der richtige Quelltext:

@echo off

title Rechner

set /p name=Name eingeben:

IF "%name%"=="User" goto rechner

:nichtzugelassen

echo Sie sind nicht zugelassen!

goto schluss

:rechner

set /p operation=Welche Rechenoperation wollen Sie anwenden?

IF "%operation%"=="Addition" goto addition

IF "%operation%"=="Multiplikation" goto multiplikation

:falsch

echo "%operation%" ist keine Rechenoperation.

goto schluss

:addition

set /p addeins=1.Summand:

set /p addzwei=2.Summand:

set /a x=addeins+addzwei

echo Summe:%x%

echo.

echo.

goto addition

:multiplikation

set /p muleins=1.Faktor:

set /p mulzwei=2.Faktor:

set /a x=muleins*mulzwei

echo Produkt:%x%

echo.

echo.

goto multiplikation

:schluss

pause>nul

Batch-Programmierung

Batch ist keine Programmiersprache!

Bitte sag nie "Ich programmiere in Batch" o.Ä sonst wird es echt peinlich.

Und bitte: Wir haben hier Code-Tags. Die kosten nichts also nutzen!

Grüßle

Hamster

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.