SheerPower® 4GL -- Beyond BASIC --

Sample Quiz Program

FREE!! Download SheerPower 4GL NOW! Documentation SheerPower 4GL Technical Support Options FAQ
Discussion Forum   Sample Programs Contact Us
Sample Progams Overview

Writing and Running the Sample Programs

Menu Program

A Simple Quiz

Expression Evaluator

SheerPower 4GL Home

Sample Quiz Program

This is a very short quiz program. The program shows how your SheerPower 4GL program can include a "web-feel" using the powerful INPUT DIALOGBOX feature. INPUT DIALOGBOX is no longer supported. Instead use SheerPower Web Scripting.

// A simple quiz program 

  woodpecker$ = 'sheerpower:samples\woodpecker.jpg' 

  quiz_form$ = '<sheerpower persist><title>Quiz</title><form>' + 
               '<center><h3>Skill Testing Question</center></h3>' + 
               '<img src="' + woodpecker$ + '" border=3 align=middle>' 
  quiz_form$ = quiz_form$ + '<font color=green> ' + 
               '<b>What type of woodpecker' + 
               ' is in this photograph?</b></font><p>' 
  quiz_form$ = quiz_form$ + '<input type=radio name=birdname ' + 
               'value="Pileated Woodpecker"> ' + 
               '<i>Pileated Woodpecker<p>'  
  quiz_form$ = quiz_form$ + '<input type=radio name=birdname ' + 
               'value="Hairy Woodpecker"> Hairy Woodpecker<p>' 
  quiz_form$ = quiz_form$ + '<input type=radio name=birdname ' + 
               'value="Redheaded Woodpecker"> ' + 
               'Redheaded Woodpecker</i></b>'  
  quiz_form$ = quiz_form$ + '<p><input type=submit name=submit value="Submit">' + 
                            '<input type=submit name=exit>' + 
  correct$ = 'Hairy Woodpecker' 
  good$ = '<sheerpower width=500 height=300 color=green>' + 
          '<form><h1>Congratulations!!  ' + 
          correct$ + ' is the correct answer!!</h1>' + 
          '<p><center><input type=submit></center></form>'    

    line input dialogbox quiz_form$: ans$ 
    if _exit then stop
    z0$ = element$(ans$, 1, chr$(26)) // get the first response
    value$ = element$(z0$, 2, '=')    // get the the value  (name=value)
    if value$ = correct$  then exit do
    message error: "Sorry, this is not a ";value$ 
  line input dialogbox good$: ans$ 

Questions, comments and suggestions are welcome!

Copyright (c) 2003-2016 Touch Technologies, Inc. All rights reserved.
Parts of the SheerPower technology are U.S. patented under patent#s 6822586, 7149765, and 8164492