(* Assignment: #20 Programmed by: Nick Snead Course: CS430 Dr. Adams Fall 2004 Language: Oberon-2 Compiler: Pow! Environment: WindowsXP Purpose: The purpose of this program is to let students become familiar with their program language they were given to learn. INPUT: They user is prompted to enter a string. That string is placed into an array that can hold up to 49 characters. OUPUT: A description of the program, details of what to do in program, and the values the user entered are displayed on the screen. THIS CODE ILLUSTRATES THE FOLLOWING STATEMENTS a. Assignment b. Selection c. Iteration d. Input e. Output *) MODULE Ass; (*Modules that have been pre-defined for programmers to use input and output methods*) IMPORT Out, In; PROCEDURE ProgMain*; (*The procedure that is the driver for the program*) (* --------------------------Variable Declaration Section ----------------------*) VAR (*holds an integer value *) mofo, i: INTEGER; (*holds a single character*) czar: CHAR; (*holds character string up to 49 characters; the last slot is used for termination character*) crap : ARRAY 50 OF CHAR; (*holds character string up to 32 characters; the last slot is used for termination character*) nickstring : ARRAY 33 OF CHAR; (*---------------------------------------------------------------------------*) BEGIN (*Example of Output*) Out.String("Well, Hello Dr Adams!! "); Out.Ln; (*Prints out a blank line and cursor starts at begining of next line*) Out.Ln; Out.String("How are you doing today?"); Out.Ln; Out.Ln; Out.String("Please enter you current emotional state."); Out.Ln; Out.String("I dont what you are using to run this program so there"); Out.Ln; Out.String("may be a text box located on your screen or not."); Out.Ln; Out.Ln; Out.String("If there is a textbox located on your screen then enter your"); Out.Ln; Out.String("current emotional state there. If you dont see a text box"); Out.Ln; Out.String("or any thing to enter data into, then just try entering your"); Out.Ln; Out.String("response on the screen."); Out.Ln; Out.Ln; Out.String("Press the enter key after you have typed your response"); Out.Ln; Out.Ln; In.String(crap); (*Example on how to get input value*); Out.String("Your emotional state was:"); Out.String(crap); Out.Ln; Out.String("How wonderful it is to feel "); Out.String(crap); Out.String("."); Out.Ln; Out.Ln; (*Examples of Assignment*) nickstring := "Nick is going to get an A in 430"; mofo :=92; (*Show that assignment worked by printing out assigned values*) Out.String(nickstring); Out.Ln; Out.String("Can you believe he got a "); Out.Int(mofo,0); Out.String(" on the 430 midterm!"); Out.Ln; Out.String("He would get even higher grades if the CS teachers would"); Out.Ln; Out.String("go easy on all the homework and assignments."); Out.Ln; Out.String("The CS students have too much work. WEW, unbelievable amounts!"); Out.Ln; Out.Ln; (*Example of selection*) IF mofo >90 THEN Out.String("Nick is doing so well in the class he shouldn't have to take the final."); ELSE Out.String("Nick must be slacking, because he should not get nothing less than an A."); END; (*Every if statement must have an END *) Out.Ln; (*EXAMPLE OF ITERATIVE STATEMENT combined with selection statement*) i := 0; (*THE LOOP CONTROL VARIABLE*) WHILE i < 3 DO IF mofo > 90 THEN Out.String("YAY FOR MRS. ADAMS!"); Out.Ln; ELSE Out.String("BOO FOR MRS. ADAMS!"); Out.Ln; END; i := i+1; (* increment loop control variable *) END; END ProgMain; END Ass.