Adding more Logical Operators
#4
And here with a subprogram - Everything works.:

Code: (Select All)
'Beispiel fuer sleep - 3. Juni 2022

OPTION _EXPLICIT

DIM kw_eingabe AS DOUBLE, ps AS DOUBLE
DIM i AS INTEGER

SCREEN _NEWIMAGE(800, 600, 32)

CLS
PRINT
PRINT "Rechnet Kilowatt(KW) in PS um": PRINT
INPUT "Geben Sie die Motorleistung ein (KW): ", kw_eingabe
PRINT

FOR i = 1 TO 10
  ps = kw_eingabe * 1.36
  PRINT USING "###.## KW sind ###.## PS"; kw_eingabe, ps
  IF i MOD 3 = 0 THEN
    SLEEP 3 '3 Sekunden warten
  ELSEIF i MOD 4 = 0 THEN
    PRINT
    CALL Quadratvolumen(i)
  END IF
  PRINT
  kw_eingabe = kw_eingabe + 5.0
NEXT

END

SUB Quadratvolumen (i)
  DIM volumen AS DOUBLE

  volumen = (i * i) * i
  PRINT USING "Ein Wuerfel von ##.## cm Kantenlaenge hat ein Volumen von ###.## qcm"; i, volumen
END SUB


[Image: Sleep-mit-Subvariante2022-06-04.jpg]
Reply


Messages In This Thread
Adding more Logical Operators - by Dimster - 05-21-2022, 08:05 PM
RE: Adding more Logical Operators - by Dimster - 06-02-2022, 12:47 PM
RE: Adding more Logical Operators - by Kernelpanic - 06-04-2022, 04:15 PM
RE: Adding more Logical Operators - by Dimster - 06-05-2022, 01:03 AM
RE: Adding more Logical Operators - by vince - 06-06-2022, 11:14 PM
RE: Adding more Logical Operators - by Dimster - 06-07-2022, 09:58 PM
RE: Adding more Logical Operators - by madscijr - 06-13-2022, 07:19 PM
RE: Adding more Logical Operators - by madscijr - 06-13-2022, 07:01 PM
RE: Adding more Logical Operators - by madscijr - 06-14-2022, 03:52 AM
RE: Adding more Logical Operators - by madscijr - 06-14-2022, 06:59 PM
RE: Adding more Logical Operators - by madscijr - 06-14-2022, 07:58 PM



Users browsing this thread: 5 Guest(s)