I need help with these programs.....
I need help with these programs.....
1) I need to write a program that finds all the vampire numbers and outputs it to a text file. Ex: 15 x 93 = 1395
2) I also need to write this prgram: Solve the following cryptogram.....
BP WPVBKPW PBLKE, LKP IKWQPKZ CBFM W XBKC FD FMKBQ DCP BLHQDXKLKPF. PDCWZWNE, LKP IKWQP CBFM W XBKC FD FMK WHHQDJWFBDP DS DFMKQE.
PLEASE PLEASE help me!!! IF youo know how to write these programs please tell me or if you know anything, im desperate.
2) I also need to write this prgram: Solve the following cryptogram.....
BP WPVBKPW PBLKE, LKP IKWQPKZ CBFM W XBKC FD FMKBQ DCP BLHQDXKLKPF. PDCWZWNE, LKP IKWQP CBFM W XBKC FD FMK WHHQDJWFBDP DS DFMKQE.
PLEASE PLEASE help me!!! IF youo know how to write these programs please tell me or if you know anything, im desperate.
If the teacher is bad, go to the principal and explain the situation. if the teacher is as bad as you claim others feel the same so you should have no problems in either getting the teacher a warning or making her epxlain stuff.
String conversion functions are functions that work on strings and convert them in one way or another.. such as: STR$(), LEFT$(), RIGHT$(), MID$(), VAL()
String conversion functions are functions that work on strings and convert them in one way or another.. such as: STR$(), LEFT$(), RIGHT$(), MID$(), VAL()
I have left this dump.
Hey, wait a sec! It is possible to decifer cryptograms w/o knowing the original crypting algorithm. It wouldnt be easy though. You first need a list of all the words in the english language. Then you have the program solve it just the way you would. I dont feel like explaining the logic. And as for the wompire numbes... It ain't THAT hard. Think about what your doing. Go through 2 sets of numbers, multiply em,' check to see if they create a number contating the characters in the original 2.
C:\DOS
C:\DOS\RUN
RUN\DOS\RUN
C:\DOS\RUN
RUN\DOS\RUN
- The Awakened
- Veteran
- Posts: 144
- Joined: Sun Aug 07, 2005 1:51 am
Zamaster: I just realized... your signature has backslashes (//), they should be regular slashes (\\) if you want it to be like DOS's filesystem.
And to the original poster: think about the problem you're trying to solve. Do you know how many times you're going to have to run the loop? If so, you'll want to use a For...Next loop. If you don't know, or you want to run it indefinately, use a do loop.
And to the original poster: think about the problem you're trying to solve. Do you know how many times you're going to have to run the loop? If so, you'll want to use a For...Next loop. If you don't know, or you want to run it indefinately, use a do loop.
"Sorry for beating you up with a baseball bat Julian, but I DID think that you were a samsquanch."
Here's is what the problem says: THE CHALLENGE...Write a program,as short as possible, that finds every vampire number and outputs it toa text file.
-OK! I think i got it tell me if i do.... here is what i wrote
CLS : FOR q = 10 TO 99
FOR p = 10 TO 99
c$ = LTRIM$(RTRIM$(STR$(q * p))) 'candidate product in string
' "parse"
u$ = LEFT$(LTRIM$(RTRIM$(STR$(q))), 1) 'factor 1 byte 1
d$ = RIGHT$(LTRIM$(RTRIM$(STR$(q))), 1) 'factor 1 byte 2
t$ = LEFT$(LTRIM$(RTRIM$(STR$(p))), 1) 'factor 2 byte 1
q$ = RIGHT$(LTRIM$(RTRIM$(STR$(p))), 1) 'factor 2 byte 2
bc$ = ""
IF q$ + t$ + d$ + u$ = c$ OR q$ + t$ + u$ + d$ = c$ OR q$ + d$ + t$ + u$ = c$ THEN bc$ = c$
IF q$ + d$ + u$ + t$ = c$ OR q$ + u$ + t$ + d$ = c$ OR q$ + u$ + d$ + t$ = c$ THEN bc$ = c$
IF t$ + q$ + d$ + u$ = c$ OR t$ + q$ + u$ + d$ = c$ OR t$ + d$ + q$ + u$ = c$ THEN bc$ = c$
IF t$ + d$ + u$ + q$ = c$ OR t$ + u$ + q$ + d$ = c$ OR t$ + u$ + d$ + q$ = c$ THEN bc$ = c$
IF d$ + q$ + t$ + u$ = c$ OR d$ + q$ + u$ + t$ = c$ OR d$ + t$ + q$ + u$ = c$ THEN bc$ = c$
IF d$ + t$ + u$ + q$ = c$ OR d$ + u$ + q$ + t$ = c$ OR d$ + u$ + t$ + q$ = c$ THEN bc$ = c$
IF u$ + q$ + t$ + d$ = c$ OR u$ + q$ + d$ + t$ = c$ OR u$ + t$ + q$ + d$ = c$ THEN bc$ = c$
IF u$ + t$ + d$ + q$ = c$ OR u$ + d$ + q$ + t$ = c$ OR u$ + d$ + t$ + q$ = c$ THEN bc$ = c$
IF bc$ <> "" AND INSTR(dupe$, bc$) = 0 THEN dupe$ = dupe$ + bc$ + SPACE$(1): PRINT q; "x"; p; "= "; bc$
NEXT p
NEXT q
-OK! I think i got it tell me if i do.... here is what i wrote
CLS : FOR q = 10 TO 99
FOR p = 10 TO 99
c$ = LTRIM$(RTRIM$(STR$(q * p))) 'candidate product in string
' "parse"
u$ = LEFT$(LTRIM$(RTRIM$(STR$(q))), 1) 'factor 1 byte 1
d$ = RIGHT$(LTRIM$(RTRIM$(STR$(q))), 1) 'factor 1 byte 2
t$ = LEFT$(LTRIM$(RTRIM$(STR$(p))), 1) 'factor 2 byte 1
q$ = RIGHT$(LTRIM$(RTRIM$(STR$(p))), 1) 'factor 2 byte 2
bc$ = ""
IF q$ + t$ + d$ + u$ = c$ OR q$ + t$ + u$ + d$ = c$ OR q$ + d$ + t$ + u$ = c$ THEN bc$ = c$
IF q$ + d$ + u$ + t$ = c$ OR q$ + u$ + t$ + d$ = c$ OR q$ + u$ + d$ + t$ = c$ THEN bc$ = c$
IF t$ + q$ + d$ + u$ = c$ OR t$ + q$ + u$ + d$ = c$ OR t$ + d$ + q$ + u$ = c$ THEN bc$ = c$
IF t$ + d$ + u$ + q$ = c$ OR t$ + u$ + q$ + d$ = c$ OR t$ + u$ + d$ + q$ = c$ THEN bc$ = c$
IF d$ + q$ + t$ + u$ = c$ OR d$ + q$ + u$ + t$ = c$ OR d$ + t$ + q$ + u$ = c$ THEN bc$ = c$
IF d$ + t$ + u$ + q$ = c$ OR d$ + u$ + q$ + t$ = c$ OR d$ + u$ + t$ + q$ = c$ THEN bc$ = c$
IF u$ + q$ + t$ + d$ = c$ OR u$ + q$ + d$ + t$ = c$ OR u$ + t$ + q$ + d$ = c$ THEN bc$ = c$
IF u$ + t$ + d$ + q$ = c$ OR u$ + d$ + q$ + t$ = c$ OR u$ + d$ + t$ + q$ = c$ THEN bc$ = c$
IF bc$ <> "" AND INSTR(dupe$, bc$) = 0 THEN dupe$ = dupe$ + bc$ + SPACE$(1): PRINT q; "x"; p; "= "; bc$
NEXT p
NEXT q
- The Awakened
- Veteran
- Posts: 144
- Joined: Sun Aug 07, 2005 1:51 am
This is BBCode, remove the asterisks to input it.
[*code]Input Code Here[*/code]
The result:
in a code statement, you can also space as much as you want, so your code will also gain legibility
[*code]Input Code Here[*/code]
The result:
Code: Select all
Input code here
Yuck, I lost my appetite when I saw that code, just kidding. But, it could be a bit better.
At least I like this code better. Everybody else might say otherwise.
Code: Select all
DECLARE FUNCTION num$ (nm&)
FOR mul1% = 1 TO 400
FOR mul2% = 1 TO 400
mstr$ = num$(CLNG(mul1%) * CLNG(mul2%))
nstr$ = mstr$
m1$ = num$(CLNG(mul1%)): m2$ = num$(CLNG(mul2%))
f% = 0
FOR i% = 1 TO LEN(m1$)
test% = INSTR(nstr$, MID$(m1$, i%, 1))
IF test% <> 0 THEN
MID$(nstr$, test%, 1) = SPACE$(1)
f% = f% + 1
ELSE
EXIT FOR
END IF
NEXT i%
FOR i% = 1 TO LEN(m2$)
test% = INSTR(nstr$, MID$(m2$, i%, 1))
IF test% <> 0 THEN
MID$(nstr$, test%, 1) = SPACE$(1)
f% = f% + 1
ELSE
EXIT FOR
END IF
NEXT i%
IF f% = LEN(m1$) + LEN(m2$) THEN
PRINT mstr$+","+m1$+","+m2$
END IF
NEXT mul2%
NEXT mul1%
FUNCTION num$ (nm&)
num$ = RIGHT$(STR$(nm&), LEN(STR$(nm&)) - 1)
END FUNCTION
C:\DOS
C:\DOS\RUN
RUN\DOS\RUN
C:\DOS\RUN
RUN\DOS\RUN
By spacing on do..loops, for..nexts, while..wends, and if..then..end if statements as well as subs and functions. If you were a C programmer at one point, you would know the importance of tabbing & spacing for example:Anonymous wrote:Well how could i make my program shorter and more legable???? Remember ima noobie so i wont understand most the stuff you are talking about unless you explain it. By the way thank you for the help.
Which is more readable and understandable?
Code: Select all
CLS
SCREEN 18
DO
PSET(x, y), RND * 15
x = x + 1
y = y + 1
LOOP
Code: Select all
CLS
SCREEN 18
DO
PSET(x,y), rnd * 15
x = x + 1
y = y + 1
LOOP