Announcement

Collapse
No announcement yet.

muiltple inputs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jerry Fielden
    replied
    There's many ways for doing this, but if you want to see the average as you enter them, you might try something like this:

    Code:
    #COMPILE EXE
    
    FUNCTION PBMAIN () AS LONG
    
       LOCAL Grading AS STRING, Grades AS LONG, nbr AS LONG
    
       WHILE Grading <> "end"
          INCR nbr
          LOCATE 8, 39 : PRINT SPACE$(10)
          LOCATE 8, 10 : LINE INPUT "Enter a Grade or end to quit "; Grading
          Grades = Grades + VAL(Grading)
          LOCATE 10, 10 : PRINT "The Average grade for "; nbr; " Entries is "; Grades\nbr
       WEND
      
    
     END FUNCTION

    Leave a comment:


  • Fred Harris
    replied
    Set it up that the user enters grades seperated by whatever delimiter you specify, then [ENTER] at the end of line when done. Then use ParseCount and Parse to take it all apart, divide by the # delimiters, etc.

    Leave a comment:


  • Chris Holbrook
    replied
    Originally posted by David Sherwood View Post
    how do i get unlitemed inputs ...
    Search me. Start with a spellchecker?

    Leave a comment:


  • Michael Mattias
    replied
    Basically you write these kinds of programs by prompting for grades, and ending when some special value is entered. eg in PB/CC you might write

    Code:
    LOCAL Grade$
    LOCAL nGrade AS LONG, iGrade AS LONG, tGrade AS LONG 
     DO 
         LINE INPUT "Grade", Grade$
        IF Grade = "END"   THEN 
             PRINT USING$ ( # grades  averaging ##.##  processed.", ngrade, tGrade/nGrade)
             EXIT DO 
        ELSE
           INCR nGrade
           iGrade =  VAL (Grade$) 
           tGrade  = tGrade + iGrade
           PRINT USING$("#,  grades processed so far", nGrade)
        END IF 
    LOOP
    It could use a litt... er, a lot of refinement

    MCM

    Leave a comment:


  • David Sherwood
    started a topic muiltple inputs

    muiltple inputs

    i am writing a grade cal. i have written the code to take five grade inputed by the user and / then by 5. how do i get unlitemed inputs and then / by that #.
Working...
X
😀
🥰
🤢
😎
😡
👍
👎