Posts: 5
Threads: 2
Joined: Jun 2003
Please don't laugh at me just because i know very little about programming :oops:
BTW, can you attach the file in this post on the program, I tried to do it, but it gives error in each line! or send me the program in amulgrg@yahoo.com It would be very helpful cuz i don't see anywhere going with my program.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Bah, nobody is laughing at you
Do something:
1.- Open notepad.
2.- Select the code in this thread.
3.- Press CTRL+C
4.- On the notepad, press CTRL+V
5.- Select "save to"
6.- On the files window, select "All Files (*.*)"
7.- Type in PROGRAM.BAS or something, press ENTER.
Now you should be able to open the program from QB.
Posts: 3,343
Threads: 83
Joined: Mar 2003
And long lines will wordwrap in Notepad... so you may have to fix those when you use it in QB.
Na_th: add to wiki? I'm goin' to school now, no time.
Posts: 2,765
Threads: 138
Joined: Nov 2002
YOu could also save it as a text.
1. To open a txt in qbasic goto OPEN
2. Type *.txt (or *.* to view all files)
3. There.
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Quote:And long lines will wordwrap in Notepad... so you may have to fix those when you use it in QB.
Na_th: add to wiki? I'm goin' to school now, no time.
You just have to unset an option to break lines. Word wrapping can be deactivated.
Posts: 1,956
Threads: 65
Joined: Jun 2003
Friend, this program which your teacher wrote is a mess.
Why do in 3 FOR loops for character validation what can be done in one.
Also, what are the complete syntax rules for an email address? He should have defined them.
Also, why is the program totally unstructured. It makes it very hard to read.
Ok, after all that, I'll point out some bugs with comments IN SOLID CAPS. Sorry but I really don't have enough time to compile it and test it. Hope this helps.
--------------------------------------------------------------------------------
DEFINT A-Z 'AS A HABIT YOU SHOULD DO THIS, ELSE USE DIM'S.
REM YOU SHOULD ALSO GET IN THE HABIT OF DEFINING AND
REM INITIALIZING ALL YOUR VARIABLES.
CLS
INPUT "Enter email address"; a$
a$ = UCASE$(a$)
l = LEN(a$)
FOR i = 1 TO l
b$ = MID$(a$, i, 1)
SELECT CASE b$
CASE "@"
e = e + 1
CASE " "
e = e + 1
REM THIS MAKES NO SENSE, IF A$ CONTAINS ONE SPACE
REM SOMEWHERE AND NO AT-SIGN, YOU'LL PRINT VALID.
END SELECT
NEXT i
IF e > 1 THEN PRINT "invalid" ELSE PRINT "valid"
FOR j = 1 TO l
b$ = MID$(a$, j, 1)
SELECT CASE b$
CASE "@"
at = j + 1
CASE "."
at = j - 1
td = j + 1
END SELECT
NEXT j
IF at <> 0 THEN
FOR k = at TO dt
s$ = MID$(a$, k, 1)
s = ASC(s$)
SELECT CASE s
CASE IS <= 64
e1 = e1 + 1
CASE IS >= 91
e1 = e + 1 'THIS I THINK SHOULD BE E1=E1+1
END SELECT
PRINT e, at, dt, s, e1
NEXT k
END IF
IF td <> 0 THEN
FOR p = td TO l
m$ = MID$(a$, p, 1)
l$ = l$ + m$
NEXT p
END IF
PRINT l$
IF l$ <> "com" THEN c5 = 1 'C5 IS NEVER REFERRENCED.
IF e <> 1 OR e1 > 0 OR l = 0 THEN PRINT "invalid" ELSE PRINT "va
END
Posts: 5
Threads: 2
Joined: Jun 2003
Yo dudes, i've tried the program, but wtf? It gives...out put as "-1" and nothing.
I can't input e-mail address, can get what the real output, no nothing, not even close to my program...
BTW, i don't see any input statements in there nor the print outputs..am I the only one here to not get it?????? PLZZ help, i need to submit this project 2morrow....
Posts: 3,368
Threads: 195
Joined: Jan 2003
wow, that's really ignorant. Learn to think.
PRINT is.email.address%("a4@r.5.5.5")
-1 IS TRUE.
0 IS FALSE
email$ = "a4@r.5.5.5"
IF is.email.address%(email$) THEN PRINT email$ +"is an email address." ELSE PRINT email$ + "isn't an email address."
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.