Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / want to create name and have it come up in other places

Author
Message
sinkler20
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location: United States
Posted: 22nd Mar 2003 05:38
Hello,
I'm trying to learn programming (so I'm playing around )
but I want to be able to input a name and retrieve it at a later time.
cane someone help. here's my learning, practice code..so don't laugh..please
thanks David p.s. if you see anything else in there you can help with, feel free.

rem batting average
rem center text 25
rem RGB(255,255,0)1
set text to bolditalic
set text size 16
ink 5000,20

circle 300,250,100

x = 100
y = 100
rem text x,y, 100
rem return dword = RGB(255,0,255)
name$= Z$
print " what is your name?"
input Z$
rem print name$
print " number of at bats"

input a#
print " number of hits"
input b#
c# = b# / a#
print " batting average"
set text size 35
print c#
if c#
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 22nd Mar 2003 05:41
Code is nearly there Try putting the name$=z$ after the input z$ line - if you think about it logically at that point in the code z$ doesn't equal anything, only after the input command does it contain something.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
sinkler20
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location: United States
Posted: 22nd Mar 2003 05:54
thanks Rich,
then all I have to do is:
print Z$ anywhere in the program....that's cool.
thanks again
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 22nd Mar 2003 05:58
Yes - or how about this:

input "Enter your name:",name$

Then you can just use "print name$" anywhere in your program.

Much easier, no?

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
sinkler20
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location: United States
Posted: 22nd Mar 2003 06:10
even better.... your the man.
thanks
sinkler20
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location: United States
Posted: 22nd Mar 2003 08:58
this is my first learning, trial and error ,goof off,just trying to figur it out program. please pick it apart.....thanks




rem batting average
rem center text 25
rem RGB(255,255,0)1
set text to bolditalic
set text size 10
ink 5000,20

circle 300,250,100

x = 100
y = 100
rem text x,y, 100
rem return dword = RGB(255,0,255)


input " what is your name ", name$

rem print name$
cls
begin:
print name$
print " number of at bats"

input a#
print " number of hits"
input b#
c# = b# / a#
cls
print " batting average"

set text size 16
print c#
wait 3000
if c# <= .220
rem set text size 10
print "go back to the minors,", name$," !!! "
wait 3000
end

else

print "welcome aboard, ", name$
wait 2000
cls
print " what are you waiting for?"
wait 1000
print " go hit one..... "
rem set text size 10
wait 3000
cls
print "your up to bat,",name$,
wait 1000
PRINT "... hurry up!"
wait 2000
endif
rem endif
print " would you like to enter more"
print "at bats ",name$,"?"
wait 2500
print " spacekey for yes, enter for no"
wait key

rem yes = y
rem no = n
if returnkey ()
print " arn't you having fun?....."
wait 1000
print " bye"
wait 3000
end
else spacekey =1
goto begin:
rem if returnkey =()
endif

rem shiftkey =()
rem goto theend:
rem wait 2000
rem endif
theend:

rem endif
rem end
rem wait 2000

philippians 4:13

Login to post a reply

Server time is: 2024-11-24 05:53:22
Your offset time is: 2024-11-24 05:53:22