Simple Program that was made for yesterday

Blitz3D Forums/Blitz3D Beginners Area/Simple Program that was made for yesterday

It was really made for Friday the 13th, but... here you go.

Graphics 800,600,16,1
Print "Type in the date - example: 40505 is April 5, 2005. "
date$=Input("")
Global amountindate= Len(date$)
word$=date
find$="13"
location=Instr(word$,find$)
If location=0 Then
	Print "Cool."
	Goto qwerty
EndIf
If location<>2 And amountindate=5 Then
	Print "Cool."
	Goto qwerty
EndIf
If location<>3 And amountindate=6 Then
	Print "Cool."
	Goto qwerty
EndIf
If location=2 And amountindate=5 Then
	friday=Input("Is it Friday? (1 = yes, 0 = no.) ")
	Goto nextthing
EndIf
If location=3 And amountindate=6 Then
	friday=Input("Is it Friday? (1 = yes, 0 = no.) ")
	Goto nextthing
EndIf
.nextthing
If friday=1 Then
	Print "AAAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!!!! IT'S FRIDAY THE 13TH!!!!!!!!!!!!!!!!!!!! I GOTTA HIDE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 
	Goto qwerty
Else
	Print "Cool."
	Goto qwerty
EndIf
.qwerty
Delay 5000
End



Also, remember the example.
You can type 040909 instead of 40909, but it wasn't made like that.

indenting?
gotos/labels :S

Are you asking for help? ^^

No…
People get mad when I post this kind of thing in the Blitz Showcase.

I've gone blind!

gotos/labels :S

What is a label :P

ehm...
goto alpha
.alpha


.alpha = label :)

Uhhh...
Hehe before today I remembered what a label is…
I forgot when I posted :P

For Future reference, Instr returns an integer, not a string.

If you feel like a challenge, now try rewriting the program so that it detects automatically if it's Friday the 13th without me having to enter anything.

Hint #1: You can change your date to test/debug.

#1-Right... I should fix that. You mean I shouldn't do quotes?

#2-I can't do that yet. I'm still new at programming and have no idea how.

You mean I shouldn't do quotes?

Yes, that's what I mean.

#2-I can't do that yet. I'm still new at programming and have no idea how.

I know, that's why it's a challenge ;) Break it down into small parts, figure out what the first thing you don't know is, and post for help on it.

Or don't, if you don't want to, it was just a suggestion to help you learn. I always learned by setting myself a challenge to do something I didn't know how to do.

Graphics 800,600,16,2

Print "Type in the date - example: 40505 is April 5, 2005. "
date$=Input("")
amountindate= Len(date$)
word$=date
find$="13"
location=Instr(word$,find$)

ok = False

If location=0 Then ok = True
If location<>2 And amountindate=5 Then ok = True
If location<>3 And amountindate=6 Then ok = True

If Not ok Then
	friday=Input("Is it Friday? (1 = yes, 0 = no.) ")
	If friday = 0 Then ok = True
EndIf


If Not ok Then
	Print "AAAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!!!! IT'S FRIDAY THE 13TH!!!!!!!!!!!!!!!!!!!! I GOTTA HIDE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 
Else
	Print "Cool."
EndIf

Delay 5000
End


Ok...That looks easier to do. And I get what every line of code means. But I'm not used to that. I'll try to get used to it, though.