SheerPower® 4GL -- Beyond BASIC --

Sample Quiz Program

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

Writing and Running the Sample Programs

Menu Program

A Simple Quiz

Headline News Reader

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.


// 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>' + 
                            '</form>' 
  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>'    

  do
    line input dialogbox quiz_form$: ans$ 
    if _exit then stop
    value$ = element$(ans$, 2, '=')  
    if value$ = correct$  then exit do
    message error: "Sorry, this is not a ";value$ 
  loop
  line input dialogbox good$: ans$ 
  end


Questions, comments and suggestions are welcome!



Copyright (c) 2003-2010 Touch Technologies, Inc. All rights reserved.
Parts of the SheerPower technology are U.S. patented and patent pending.