$CPU 8086 ' make compatible with XT systems $LIB ALL OFF ' turn off all PowerBASIC libraries $ERROR ALL OFF ' turn off all PowerBASIC error checking $OPTIMIZE SIZE ' optimize for smaller code $COMPILE UNIT ' compile to a UNIT (.PBU) '$COMPILE EXE ' compile to a UNIT (.PBU) DEFINT A-Z ' Required for all numeric functions, forces PB to not ' include floating point in UNIT (makes it smaller) '/*------------------------------------------------------------------*/ $CODE SEG "MLIB4" '/*------------------------------------------------------------------*/ ' COPIES(STRING,NBR) ' Returns a string contain NBR copies of STRING. ' EXMAPLES: COPIES("abc",3) = "abcabcabc" ' COPIES("|",4) = "||||" '/*------------------------------------------------------------------*/ FUNCTION COPIES(BYVAL X AS STRING, BYVAL XN AS INTEGER) PUBLIC AS STRING XRET$ = "" IF XN > 0 THEN FOR CNT = 1 TO XN XRET$ = XRET$ + X NEXT CNT END IF COPIES = XRET$ END FUNCTION '/*------------------------------------------------------------------*/ ' CLS ' PRINT COPIES(")",4);" '))))' " ' PRINT COPIES("abc",3);" 'abcabcabc' " ' PRINT COPIES("abc",0);" '' " ' INPUT Z