anoniem Geplaatst: 31 augustus 2002 Delen Geplaatst: 31 augustus 2002 als ik 5 sterrekes tegelijk wil afdrukken is er daar een functie voor, maar welke was dat ook weer ??? print defunctiedakzoek("*",5) :-? Quote Link naar reactie
anoniem Geplaatst: 31 augustus 2002 Auteur Delen Geplaatst: 31 augustus 2002 print = qbasic, niet vb lprint = naar printer (d8 ik) de functie die je zoeket heet string$, de beschrijving hieronder komt uit de qbasic 7.1 help [code:1:2c3303512e]STRING$(m%,n%) or STRING$(m%,stringexpression$) * m% A numeric expression indicating the length of the string to return. * n% An integer expression with a value between 0 and 255 that is the ASCII character code of the character that fills the string. * stringexpression$ A string whose first character fills the string. Returns A string whose characters all have a given ASCII code or whose characters are all the first character of a string expression.[/code:1:2c3303512e] [code:1:2c3303512e]'This example uses the STRING$ function to generate a bar graph. CLS PRINT TAB(7);"Daily Mean Temperature in Seattle" PRINT 'Get data for each month and graph. FOR Month = 1 TO 12 STEP 2 READ Month$, Temp 'Print Temp-35 stars. PRINT Month$;" +"; STRING$(Temp-35,"*") PRINT " |" NEXT Month 'Print horizontal line. PRINT " +"; FOR X = 1 TO 7 PRINT "----+"; NEXT X PRINT 'Print temperature labels. FOR X = 4 TO 39 STEP 5 PRINT TAB(X); X+31; NEXT X PRINT DATA Jan, 40, Mar, 46, May, 56 DATA Jul, 66, Sep, 61, Nov, 46 'Sample Output ' 'Daily Mean Temperature in Seattle ' 'Jan +***** ' | 'Mar +*********** ' | 'May +********************* ' | 'Jul +******************************* ' | 'Sep +************************** ' | 'Nov +*********** ' | ' +----+----+----+----+----+----+----+ ' 35 40 45 50 55 60 65 70 [/code:1:2c3303512e] Snappie? :wink: Quote Link naar reactie
anoniem Geplaatst: 2 september 2002 Auteur Delen Geplaatst: 2 september 2002 MsgBox String("*", 5) Quote Link naar reactie
anoniem Geplaatst: 2 september 2002 Auteur Delen Geplaatst: 2 september 2002 Let op!! Omdat de functie een string (tekst) als output geeft moet er een dollarteken ($) achter de functienaam. Bovendien draai je de twee variabelen (degeen die het aantal tekens doorgeeft en het teken) Goede syntaxis: string$(5,"*") Voorbeeld: msgbox string$(5,"*") Quote Link naar reactie
anoniem Geplaatst: 3 september 2002 Auteur Delen Geplaatst: 3 september 2002 Oeps, ja foutje. Overigens is het niet gebruikelijk dat je in Visual Basic het type dat geretourneerd wordt door een functie achter de functienaam zet (voor de typen die met een teken gerepresenteerd kunnen worden, zoals String ($), Integer (%) en Long (&)). De definitie van de functie bepaalt al wat voor type er wordt geretourneerd. Quote Link naar reactie
anoniem Geplaatst: 3 september 2002 Auteur Delen Geplaatst: 3 september 2002 Tsja.. ik ben ook begoinnen met qbasic - en het werkt wel :) Quote Link naar reactie
Aanbevolen berichten
Om een reactie te plaatsen, moet je eerst inloggen