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 / I'm an idiot. Please help. I want to use input so I can repeat what someone's said.

Author
Message
Professor Bob Bobson
19
Years of Service
User Offline
Joined: 6th Apr 2005
Location: I\'m behind you!!!!
Posted: 6th Apr 2005 23:36
Hi,
Just say I wanted to ask someone what they wanted to eat/drink/dive in. I would say something like:
print"What do you want to eat"
Then what??? Do I put an input in? Do I write PRINT "Yes I like___ too"???

It doesn't take a genius to become a professor, but it does to programme this...
Professur Bobb

DON'T DRINK AND DRIVE.TAKE DOPE AND FLY!!!
Neil19533
21
Years of Service
User Offline
Joined: 30th Aug 2003
Location: England
Posted: 7th Apr 2005 06:09
some code to mess about with

Print "hello"
input "what is your name? ",Name$
Print "hello " + Name$
input "what is your age? ",age#
age2=age#+10
print "in ten years you will be " + str$(age2) + " years old."
wait key

Any spelling mistakes are totally In tensional.
Professor Bob Bobson
19
Years of Service
User Offline
Joined: 6th Apr 2005
Location: I\'m behind you!!!!
Posted: 7th Apr 2005 18:42
Thanks!!! I've done that and added another bit using if.

How can I make it so there can be more than one option of flavour?

Professssurrr Bob

DON'T DRINK AND DRIVE.TAKE DOPE AND FLY!!!
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 7th Apr 2005 20:33 Edited at: 7th Apr 2005 20:43
MY NEXT POST WIL HELP U 1!!!!!!!!!!!111!!!
=======================-=====================

Neil, why have you got the age as a floating point (decimal, for the uninitiated) variable??

I mean, I'm not 100% sure how the DB compiler works, but I'm pretty sure that when it tries to do:

age2 = age# + 10

First, it'll round off age#, thus possibly telling people completely the wrong answer.

Logically, it'd be better to replace all of those instances of 'age#' with 'age' (or 'age1' for clarity), but mathematically it would be more accurate to change the whole thing to floating point:

input "What is your age? ", age#
age2#=age#+10.0
print "In ten years, you'll be "+str$(age2#)+" years old."
wait key

Arlight?
Oh wait, newbie tutorial.. Dammit..

Mr Blanky - This Time, It's Personal
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 7th Apr 2005 20:42
To answer your question, your pofessor sip:

print "What be you eating, yes yes?"
input " >> ",food$
print "HEY GIVE ME BACK MY "+food$

The '$' means it's a string, a text data type in other words.

So, if I told teh machine I'm eating 'socks' and I hit enter, my screen looks like this:

What be you eating, yes yes?
>> socks
HEY GIVE ME BACK MY socks

You could improve this by saying:

print "HEY GIVE ME BACK MY "+Upper$(food$)

What Upper$ does, is it converts something to uppercase.
The $ on it means that it gives you back text, so it can be treated as a variable (if used properly).

This would produce a nicer:

HEY GIVE ME BACK MY SOCKS

Mr Blanky - This Time, It's Personal

Login to post a reply

Server time is: 2024-09-23 17:20:55
Your offset time is: 2024-09-23 17:20:55