1 #include <stdio.h> //Input & Output Header File
2 #include <stdlib.h> //Input & Output Library Header File
3 #include <string.h> //String Header File
4
5 void main( void ) { //Main Function Beginning
6 int MyNumber; //Declare integer
7 char MyWord[100]; //Declare string array
8
9 printf( "\nType in a number ==> " ); //Print out request
10 scanf( "%d", &MyNumber ); //Read input from keyboard
11
12 //Print out input from keyboard
13 printf( "\nYou typed in the number %d.", MyNumber );
14
15 printf( "\n\nType in a word ==> " ); /Print out request
16 scanf( "%s", MyWord ); //Scan input from keyboard
17
18 //Print out input from keyboard
19 printf( "\nYou typed in the word %s.", MyWord );
20
21 printf( "\nPress any key to end." ); //Print out message
22 MyWord = getc( stdin ); //Read character from keyboard
23 } //Main Function End
Line 1: �Indicates that the input and output library is to be linked.
Line 2: �Indicates that the input and output library is to be linked.
Line 3: �Indicates that the string library is to be linked.
Line 4: �Blank Line.
Line 5: �Indicates the beginning of the main function that is called when the program first runs.
Line 6: �Indicates the declaration of a integer variable.
Line 7: �Indicates the declaration of a string variable.
Line 8: �Blank Line.
Line 9: �Indicates that the text in quotes is to be printed to the screen. �A \n indicates a carriage return.
Line 10: �Indicates that something is to be read from the keyboard. �The %d in the quotes indicates a integer number. �When reading numbers you must use a & in front of the variable name.
Line 11: �Blank Line.
Line 12: �A comment. �A // indicates a comment and will do nothing.
Line 13: �See Line 9. �A %d inside the quotes indicates that a number is to be inserted. �The variables are listed after the comma after the quotes.
Line 14: �Blank Line.
Line 15: �See Line 13. �The %s inside the quotes if for strings.
Line 16: �See Line 10. �The %s indicates that a string is to be read.
Line 17: �Blank Line.
Line 18: �See Line 12.
Line 19: �See Line 15.
Line 20: �Blank Line.
Line 21: �See Line 9.
Line 22: �Reads a single character from the keyboard.
Line 23: �Indicates the closing of the "main" function.
Visual Basic
Visual Basic is a program language that is for Windows. �It uses a visual development environment that places controls on forms and programs events for them. �This is a very easy language for beginners that are looking to make Windows programs. �I program using Visual Basic 5.0. �You can get books to learn how to use Visual Basic. �Que makes really good books that I have used to learn how to program. �I will show you how to make a simple chat program. �In order to do this you will need the Winsock.ocx control.
The WinSock control allows TCP/IP connections between your programs. �The WinSock does have one bug however, whenever the client end gets disconnected the client cannot reconnect back to the server without unloading the control or resetting the local port number. �Click here to download the program and its source code. �Just look for the program that is called Chat!
On with how I made the chat program.
| (Name) | frmMain |
| BorderStyle | 1 - Fixed Single |
| Caption | Chat! |
| Height | 4470 |
| MinButton | True |
| Width | 5385 |
| (Name) | sckTCP |
| Index | 0 |
| Left | 0 |
| Top | 0 |
| (Name) | txtChat |
| Height | 2415 |
| Left | 240 |
| Locked | True |
| MutliLine | True |
| ScrollBars | 2 - Vertical |
| TabIndex | 0 |
| Text | � |
| Top | 240 |
| Width | 4815 |
| (Name) | txtSendMsg |
| Height | 285 |
| Left | 240 |
| TabIndex | 1 |
| Text | � |
| Top | 2760 |
| Width | 3975 |
| (Name) | cmdSendMsg |
| Caption | &Send |
| Default | True |
| Height | 285 |
| Left | 4320 |
| TabIndex | 2 |
| Top | 2760 |
| Width | 735 |
| (Name) | cmdConnectDisconnect |
| Caption | &Connect |
| Height | 495 |
| Left | 240 |
| TabIndex | 3 |
| Top | 3360 |
| Width | 1455 |
| (Name) | cmdHostStopHost |
| Caption | &Host |
| Height | 495 |
| Left | 1920 |
| TabIndex | 4 |
| Top | 3360 |
| Width | 1455 |
| (Name) | cmdExit |
| Caption | &Exit |
| Height | 495 |
| Left | 3600 |
| TabIndex | 5 |
| Top | 3360 |
| Width | 1455 |
Private Type Connection_Info
sckNum As Integer 'Socket Number
ChatName As String 'Name
End Type
Dim Connections() As Connection_Info
Dim ChatName As String 'Chatroom name
Private Sub Pause()
Dim i As Integer 'For counter
For i = 0 To 500 'Pause for half a second
DoEvents 'Allow windows to continue
Next i
End Sub
Private Sub Form_Load()
'Write the instructions on the chat display text box
txtChat.Text = "Click on the CONNECT button to connect to a host. Click on the HOST button to host for connections. You can copy the text in this display by selecting the text and pressing CTRL+C. You can clear the text in this display by pressing the DEL key."
'Color in text box to look disabled
txtSendMsg.BackColor = frmMain.BackColor
'Disable text box and send button
txtSendMsg.Enabled = False
cmdSendMsg.Enabled = False
'Fill in default information
sckTCP(0).RemoteHost = "localhost"
sckTCP(0).RemotePort = "20000"
sckTCP(0).LocalPort = "20000"
ChatName = "Anonymous"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer 'For counter
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
'Figure out which sockets are still open and close them all
For i = sckTCP.LBound To sckTCP.UBound
If sckTCP(i).State <> sckClosed Then 'Open socket
sckTCP(i).Close 'Close the socket
'Pause until socket closes
Do While sckTCP(i).State <> sckClosed
DoEvents 'Allow windows to continue
'Check to make sure an error didn't occur
If Not Err.Number = 0 Then 'Error occured
Exit Do 'Exit out of loop
End If
Loop
End If
Next i
End 'Make sure program terminates
End Sub
Private Sub sckTCP_Close(Index As Integer)
Dim i, j As Integer 'For counters
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
If sckTCP(0).State = sckListening Then 'We are in host mode
sckTCP(Index).Close 'Close socket
'Determine who disconnected
For i = 1 To sckTCP.Count
If Connections(i).sckNum = Index Then 'Match between connection
'Display user who left
txtChat.Text = txtChat.Text + vbCrLf + Connections(i).ChatName + " has disconnected."
'Tell everyone else who left
For j = 1 To sckTCP.UBound
sckTCP(j).SendData Connections(i).ChatName + " has disconnected."
Call Pause 'Allow data to be sent
Next j
'Remove user from array by pushing all others down one
For j = i + 1 To sckTCP.Count
Connections(j - 1).ChatName = Connections(j).ChatName
Connections(j - 1).sckNum = Connections(j).sckNum
Next j
'Remove extra entry at end
Connections(sckTCP.Count).ChatName = ""
Connections(sckTCP.Count).sckNum = ""
Exit For 'Leave loop
End If
Next i
Unload sckTCP(Index) 'Unload socket
ReDim Preserve Connections(sckTCP.Count) 'Resize array
Else
'Host broke connection, tell user
txtChat.Text = txtChat.Text + vbCrLf + "Host broke connection."
sckTCP(1).Close 'Close connection
Unload sckTCP(1) 'Unload socket
txtSendMsg.Text = "" 'Clear out send text box
txtSendMsg.BackColor = frmMain.BackColor 'Color send box to look disabled
txtSendMsg.Enabled = False 'Disable text box
cmdSendMsg.Enabled = False 'Disable send button
'Change Disconnect button caption
cmdConnectDisconnect.Caption = "&Connect"
cmdHostStopHost.Enabled = True 'Enable host button
End If
Private Sub sckTCP_Connect(Index As Integer)
'Tell user that program connected
txtChat.Text = txtChat.Text + vbCrLf + "Connected."
'Send chat name to host
sckTCP(0).SendData "/~Name@" + ChatName
'Enable send text box and button
txtSendMsg.Enabled = True
cmdSendMsg.Enabled = True
txtSendMsg.BackColor = vbWhite 'Make text box look enabled
End Sub
Private Sub sckTCP_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Dim i As Integer 'For counter
Dim FreeSocket As Integer 'For free socket number
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
'Figure out what socket is avaiable if any
For i = 1 To sckTCP.UBound + 1
'Try to generate a '340 object doesn't exist error'
'to find a free socket space
FreeSocket = sckTCP(i).Index 'Set free socket
'Check to see if a socket didn't exist so we
'can make it exist and use it
If Err.Number = 340 Then 'Control didn't exist
FreeSocket = i 'Set free socket number
Exit For 'Leave i loop
End If
Next i
Load sckTCP(FreeSocket) 'Load new socket
sckTCP(FreeSocket).LocalPort = 0 'Assign a random port number
sckTCP(FreeSocket).Accept requestID 'Accept connection
ReDim Preserve Connections(sckTCP.Count + 1) 'Resize array of connections
Connections(sckTCP.Count).sckNum = FreeSocket 'Store connection socket number
Connections(sckTCP.Count).ChatName = "Unconnected" 'Store the default name
End Sub
Private Sub sckTCP_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim IncomingData As String
Dim i, j, k As Integer 'For counters
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
'Get incoming data
sckTCP(Index).GetData IncomingData, vbString
'Give a short pause to make sure data gets read
Call Pause
'Check to see if the host is getting information
If sckTCP(0).State = sckListening Then 'Host is
'Determine if it is the chat name of the client
If Left$(IncomingData, 6) = "/~Name" Then 'Name is coming
'Loop through all the connections
For i = 0 To sckTCP.Count
'Check to see if the current socket is in the array
If Index = Connections(i).sckNum Then 'Found match
'Give that connection a name
Connections(i).ChatName = Mid$(IncomingData, 8, Len(IncomingData))
'Tell everyone new connections name
For j = 1 To sckTCP.UBound
sckTCP(j).SendData Connections(i).ChatName + " has connected."
Call Pause 'Allow data to be sent
Next j
'Show who connected to user
txtChat.Text = txtChat.Text + vbCrLf + Connections(i).ChatName + " has connected."
Exit For 'Leave loop
End If
Next i
Else
'Information is something someone typed, so display it
'Loop through and figure out who said it
For i = 0 To sckTCP.Count
'Check for a match between socket numbers
If Index = Connections(i).sckNum Then 'Match
'Display their name and message to all
txtChat.Text = txtChat.Text + vbCrLf + Connections(i).ChatName + " says: " + IncomingData
'Send data to everyone else
For j = 1 To sckTCP.UBound
sckTCP(j).SendData Connections(i).ChatName + " says: " + IncomingData
Call Pause 'Allow data to be sent
Next j
Exit For 'Leave loop
End If
Next i
End If
Else 'Client is getting data
'Show incoming data
txtChat.Text = txtChat.Text + vbCrLf + IncomingData
End If
Private Sub sckTCP_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Dim i As Integer 'For counter
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
'Tell user what the error was and that call connections are closed
txtChat.Text = txtChat.Text + vbCrLf + "Error " & Number & ": " & Description & "." + vbCrLf + "All connections closed."
'Clear out send text box and color it to be disabled
txtSendMsg.Text = ""
txtSendMsg.Enabled = False
txtSendMsg.BackColor = frmMain.BackColor
cmdSendMsg.Enabled = False 'Disable send message button
'Reset connect/disconnect and host/stop hosting buttons
cmdConnectDisconnect.Caption = "&Connect"
cmdHostStopHost.Caption = "&Host"
cmdConnectDisconnect.Enabled = True
cmdHostStopHost.Enabled = True
sckTCP(0).Close 'Close primary socket
'Close all other sockets and unload them
For i = 1 To sckTCP.UBound
sckTCP(i).Close
Unload sckTCP(i)
Next i
End Sub
Private Sub txtChat_Change()
txtChat.SelStart = Len(txtChat.Text)
End Sub
Private Sub txtChat_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then 'Delete key was pressed
txtChat.Text = "" 'Clear out text
End If
End Sub
Private Sub cmdSendMsg_Click()
Dim i As Integer 'For counter
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
If txtSendMsg.Text = "" Then Exit Sub 'Nothing to send
'If the program is hosting then send the message to everyone else
If sckTCP(0).State = sckListening Then 'It is
For i = 1 To sckTCP.UBound
sckTCP(i).SendData ChatName + " says: " + txtSendMsg.Text
Call Pause 'Allow data to be sent
Next i
'Show message in chat text box
txtChat.Text = txtChat.Text + vbCrLf + ChatName + " says: " + txtSendMsg.Text
Else 'Not hosting, just send message
sckTCP(1).SendData txtSendMsg.Text
End If
txtSendMsg.Text = "" 'Clear out text box
End Sub
Private Sub cmdConnectDisconnect_Click()
Dim i As Integer 'For counter
Dim Response As Integer 'For users response
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
'Determine if button is suppose to connect or disconnect
If cmdConnectDisconnect.Caption = "&Connect" Then 'Connect
cmdConnectDisconnect.Caption = "&Disconnect" 'Change button caption
cmdHostStopHost.Enabled = False 'Disable host button
'Ask for the remote computer address
sckTCP(0).Tag = InputBox$("Enter the computer name or ip address of the machine you wish to connect.", "Remote Address", sckTCP(0).RemoteHost)
'Check to make sure user didn't cancel
If sckTCP(0).Tag = "" Then 'User canceled
cmdConnectDisconnect.Caption = "&Connect" 'Reset button caption
cmdHostStopHost.Enabled = True 'Enable host button
Exit Sub 'Leave sub
Else 'User entered a address
sckTCP(0).RemoteHost = sckTCP(0).Tag 'Set address
sckTCP(0).Tag = "" 'Clear out tag
End If
'Ask for the remote computer port number
sckTCP(0).Tag = InputBox$("Enter the remote computer port number.", "Remote Port Number", Str$(sckTCP(0).RemotePort))
'Check to see if user canceled
If sckTCP(0).Tag = "" Then 'User canceled
cmdConnectDisconnect.Caption = "&Connect" 'Reset button caption
cmdHostStopHost.Enabled = True 'Enable host button
Exit Sub 'Leave sub
Else 'User entered a port number
sckTCP(0).RemotePort = Val(sckTCP(0).Tag) 'Save value
sckTCP(0).Tag = "" 'Clear out tag
End If
'Ask for a chat name
ChatName = InputBox$("Enter the name you would like to be called.", "Name", ChatName)
'Check name to see if it is blank or if user canceled
If ChatName = "" Then 'User canceled
cmdConnectDisconnect.Caption = "&Connect" 'Reset button caption
cmdHostStopHost.Enabled = True 'Enable host button
Exit Sub 'Leave sub
End If
'Make a new instance of the winsock that can be unloaded when
'the connection is broken, that way the program won't get a
'address error if it tries to connect again
Unload sckTCP(1) 'Make sure doesn't exist
Load sckTCP(1) 'Load new control
sckTCP(1).RemoteHost = sckTCP(0).RemoteHost 'Set remote host
sckTCP(1).RemotePort = sckTCP(0).RemotePort 'Set remote port
sckTCP(1).LocalPort = 0 'Clear out local port number
sckTCP(1).Connect 'Attempt to connect to the remote computer
'Tell user that a connection is being attempted
txtChat.Text = txtChat.Text + vbCrLf + "Attempting to connect to " + sckTCP(1).RemoteHost + " on port number" + Str$(sckTCP(1).RemotePort) + "..."
'Pause to allow connection to catch up
Call Pause
Else 'Disconnect
'Ask user if they really wish to disconnect
Response = MsgBox("Are you sure you wish to disconnect?", vbQuestion + vbYesNo, "Chat!")
'Determine response
If Response = vbYes Then 'User said yes
sckTCP(1).Close 'Close connection
Unload sckTCP(1) 'Unload control
'Tell user connection is closed
txtChat.Text = txtChat.Text + vbCrLf + "Connection closed."
'Change button caption
cmdConnectDisconnect.Caption = "&Connect"
cmdHostStopHost.Enabled = True 'Enable host button
'Disable send box and button
txtSendMsg.Enabled = False
cmdSendMsg.Enabled = False
'Clear out send text box and color it to look disabled
txtSendMsg.Text = ""
txtSendMsg.BackColor = frmMain.BackColor
End If
End If
End Sub
Private Sub cmdHostStopHost_Click()
Dim i As Integer 'For counter
Dim Response As Integer 'For users response
'Need to skip past errors since we could get the error '340'
'because a socket didn't exist
On Error Resume Next
'Determine if program should start or stop hosting
If cmdHostStopHost.Caption = "&Host" Then 'Start hosting
cmdHostStopHost.Caption = "&Stop &Hosting" 'Reset caption
'Ask user what port to listen on
sckTCP(0).Tag = InputBox$("Enter the local port number to listen for connections on.", "Local Port Number", sckTCP(0).LocalPort)
'Check to make sure user didn't cancel
If sckTCP(0).Tag = "" Then 'User canceled
cmdConnectDisconnect.Enabled = True 'Enable connect button
cmdHostStopHost.Caption = "&Host" 'Reset caption
Exit Sub 'Leave sub
End If
sckTCP(0).LocalPort = Val(sckTCP(0).Tag) 'Set port number
'Ask for a chat name
ChatName = InputBox$("Enter the name you would like to be called.", "Name", ChatName)
If ChatName = "" Then 'User canceled
cmdHostStopHost.Caption = "&Host" 'Reset button caption
cmdConnectDisconnect.Enabled = True 'Enable connect button
Exit Sub 'Leave sub
End If
'Set socket to listen for connectins
sckTCP(0).Listen
'Tell user what program is doing
txtChat.Text = txtChat.Text + vbCrLf + "Listening for connections on port number" + Str$(sckTCP(0).LocalPort) + "."
'Enable and color in send text box and button
txtSendMsg.Enabled = True
txtSendMsg.BackColor = vbWhite
cmdSendMsg.Enabled = True
cmdConnectDisconnect.Enabled = False 'Disable connect button
Else 'Stop hosting
'Ask user if they really want to disconnect all sockets
Response = MsgBox("Are you sure you wish to disconnect all connections?", vbQuestion + vbYesNo, "Chat!")
'Determine response
If Response = vbYes Then 'Disconnect them all
'Loop through any socket controls above index zero
For i = 1 To sckTCP.UBound
sckTCP(i).Close 'Close socket
Unload sckTCP(i) 'Unload socket control
Next i
Erase Connections 'Clear out connections array
sckTCP(0).Close 'Close primary socket
'Disable send text box and button
txtSendMsg.Enabled = False
txtSendMsg.Text = ""
txtSendMsg.BackColor = frmMain.BackColor
cmdSendMsg.Enabled = False
cmdHostStopHost.Caption = "&Host" 'Reset caption
cmdConnectDisconnect.Enabled = True 'Enable connect button
'Tell user not listening
txtChat.Text = txtChat.Text + vbCrLf + "Not listening for connections."
End If
End If
End Sub
Private Sub cmdExit_Click()
Unload frmMain 'Unload this form
End Sub
QuickBasic
QuickBasic was included with DOS 6.x. �It cannot compile programs into self-running code so you have to use it to run the programs. �Here is a sample program that I made when I was learning how to program. �After running and playing it you can probably figure out I wrote around the time I had just seen the movie Jurassic Park. �It does have a cheat code though, see if you can figure it out.
CLS : numberrap = 20: auxpower = 100: part = 1
LOCATE 25
INPUT "System Ready", q$
IF q$ = "RoBear" THEN password$ = "Raptor #1": PRINT "Adnormal program start.": auxpower = 1000000: GOTO 5
CLS
PRINT "Jurassic Park Main Control"
INPUT "Enter the password. It's Raptor #1 :) ", password$
5 IF NOT (password$ = "Raptor #1") THEN PRINT "Incorrect Identification.": SYSTEM: END
PRINT "OK"
DO while INKEY$ = ""
LOCATE 3, 3, 1
LOOP
7 CLS
IF auxpower <= 30 THEN COLOR 20 ELSE COLOR 7, 0
PRINT "Jurassic Main Control"
LOCATE 10, 1, 0
PRINT "Raptor pit"
LOCATE 10, 30, 0
PRINT "Power Supplies"
LOCATE 20, 1, 0
PRINT "Fences"
LOCATE 20, 30, 0
PRINT "Animal count"
IF auxpower <= 0 THEN LOCATE 1, 1: FOR tt = 1 TO 10: FOR t = 1 TO 5000: NEXT t: PRINT "All power gone!!! The Dinosaurs have escaped. You have been eating by raptors. You lose!!!": NEXT tt: SYSTEM: END
DO
a$ = UCASE$(INKEY$)
IF a$ = "J" THEN GOTO 10
IF a$ = "R" THEN GOTO 20
IF a$ = "P" THEN GOTO 30
IF a$ = "F" THEN GOTO 40
IF a$ = "A" THEN GOTO 50
LOOP
10 CLS
PRINT "Jurassic Park"
PRINT
PRINT "1. Comm"
PRINT "2. Tour"
PRINT "3. DNA"
PRINT "4. Travel"
PRINT "5. Kill 2 Raptors."
PRINT "6. Quit Game."
11 INPUT "Type 1, 2, 3, 4, 5 or 6 and press ENTER when ready. ", want
IF want < 1 OR want > 6 THEN PRINT "Invalied selection. Please try again.": auxpower = auxpower - 15: GOTO 11
auxpower = auxpower - 9
IF want = 1 THEN
INPUT "Enter DNA code. ", dnapass$
IF dnapass$ = "5555555 T-REX" THEN
CLS
PRINT "Jurassic Comm System"
PRINT "Find the two kids lost in JP"
PRINT "by looking at Fences and the number of Animals."
DO
LOOP UNTIL INKEY$ <> ""
END IF
END IF
IF want = 2 THEN
CLS
PRINT "Jurassic Park Tour"
PRINT "The Raptors are starting to break free."
PRINT "You are Grant and must find the two kids"
PRINT " before all power is gone."
PRINT "Then you must decode the DNA strands to leave JP."
PRINT "The power amounts needed are as follows:"
PRINT "Jurassic Main Control 9% auxpower"
PRINT " 1. 9% auxpower"
PRINT " 2. 0% auxpower"
PRINT " 3. 10% auxpower"
PRINT " 4. 5% auxpower"
PRINT " 5. 0% auxpower"
PRINT " 6. 0% auxpower"
PRINT "Raptor pit 10% auxpower"
PRINT "Power Supplies 10% auxpower"
PRINT "Fences 20% auxpower"
PRINT "Animal Count 18% auxpower"
PRINT "Good Luck."
PRINT "--------------END TRANSMISSION----------------"
DO
a$ = INKEY$
LOOP UNTIL a$ <> ""
END IF
IF want = 3 THEN
INPUT "Warning!!! This will kill 5 Raptors. Ok to proceed?", o$
ok$ = UCASE$(o$)
IF ok$ = "Y" THEN
numberrap = numberrap - 5
auxpower = auxpower - 10
IF numberrap <= 0 THEN COLOR 20, 14: PRINT "Not enough of Raptors. All raptors are dead. You lose": END
PRINT
IF part = 1 THEN PRINT "DNA 555"
IF part = 2 THEN PRINT "DNA 5555555"
IF part = 3 THEN PRINT "DNA 5555555 T-"
IF part = 4 THEN PRINT "DNA 5555555 T-REX"
part = part + 1
IF part > 4 THEN part = 4
DO UNTIL INKEY$ <> ""
LOOP
END IF
END IF
IF want = 4 THEN
IF part = 4 AND kidsfound = 2 AND auxpower >= 5 THEN
PRINT "Leaving Jurassic Park. Have a safe trip.": SYSTEM: END
ELSE
PRINT "Incorrect DNA strand. Kids not with you. Go find them."
PRINT "Must have 5% or above auxpower supply left!"
DO
LOOP UNTIL INKEY$ <> ""
END IF
END IF
IF want = 5 THEN
PRINT "Killing"
IF numberrap <= 0 THEN PRINT "No Raptors to kill.": numberrap = numberrap + 2
numberrap = numberrap - 2
IF numberrap <= 0 THEN
PRINT "All raptors are dead. No power up."
ELSE
auxpower = auxpower + 19
PRINT " 10% powerup."
END IF
DO
LOOP UNTIL INKEY$ <> ""
END IF
IF want = 6 THEN SYSTEM: END
GOTO 7
20 CLS
PRINT "Raptor pit status"
PRINT
IF numberrap < 0 THEN numberrap = 0
PRINT "Number in pit "; numberrap
PRINT "Number expected "; "20"
IF numberrap > 30 THEN PRINT "Warning raptor pit to small raptors are escaping!!!"
IF numberrap = 40 THEN PRINT "Too many raptors. You bearly escape. Jurassic Park is a failer!!": END
IF numberrap <= 0 THEN PRINT "All raptors are dead. Loss of money. 70% power drain.": auxpower = auxpower - 70
IF numberrap <= 0 THEN PRINT "No more Raptors to hatch." ELSE numberrap = numberrap + 1
auxpower = auxpower - 10
PRINT "Press any key to exit"
DO UNTIL INKEY$ <> ""
LOOP
GOTO 7
30 CLS
auxpower = auxpower - 5
PRINT "Jurassic Park Power Supplies"
PRINT
IF auxpower < 0 THEN PRINT "Warning all power gone. Emergancy power kicking in.": auxpower = 20
PRINT auxpower; "% auxiliary power left."
PRINT "Main power destroyed"
PRINT "Press any key to exit"
b$ = UCASE$(INKEY$)
DO UNTIL b$ <> ""
b$ = UCASE$(INKEY$)
LOOP
IF b$ = "T" THEN auxpower = 0: PRINT "T-REX eats all power supplyes and gets fried. You eat him. All power gone.": DO UNTIL INKEY$ <> "": LOOP
GOTO 7
40 CLS
auxpower = auxpower - 20
CLS
PRINT "T-REX fences down"
PRINT "Raptor fences up"
PRINT "All fences percent working 70"
IF part = 4 AND NOT (kidsfound = 1) AND NOT (kidsfound = 2) THEN PRINT "One kid near Raptor fence.": kidsfound = 1
PRINT "Press any key to continue..."
DO
LOOP UNTIL INKEY$ <> ""
GOTO 7
50 CLS
auxpower = auxpower - 18
CLS
PRINT "Number of animals expected 1000"
PRINT "Number Found 700"
PRINT "100 are dead"
PRINT "500 animals sorce unknown. 200 in captivity."
IF numberrap <= 0 THEN PRINT "All raptors are dead!!!"
IF part = 4 AND kidsfound = 1 THEN
kidsfound = 2
PRINT "Another kid found!!"
END IF
PRINT "Press any key to continue..."
DO
LOOP UNTIL INKEY$ <> ""
GOTO 7
SYSTEM
Q++