Get Key Troubles
9 posts
• Page 1 of 1
- nagarajan
- Member
- Posts: 48
- Joined: Mon Apr 23, 2012 3:58 am
- Location: Chennai,India
- Calculators: Casio fx-9750GII, Casio fx-9860G Slim, Casio fx-9860GII
Get Key Troubles
Hi,
Am having a trouble with getkey.
Here's my code:
"KM"?->K
Do:Getkey
LpWhile Not Ans
If Ans>=25
Then Ans=76=>K+0.01->K
Ans=66=>K+0.02->K
Ans=56=>K+0.05->K
Ans=46=>K+0.1->K
Ans=36=>K+0.2->K
Ans=26=>K+0.5->K
IfEnd.
I need this fuction to work while pressing the keys.
If I press the numbers it should ask for the "KM" value and then should display the result.
Pls help.
Am having a trouble with getkey.
Here's my code:
"KM"?->K
Do:Getkey
LpWhile Not Ans
If Ans>=25
Then Ans=76=>K+0.01->K
Ans=66=>K+0.02->K
Ans=56=>K+0.05->K
Ans=46=>K+0.1->K
Ans=36=>K+0.2->K
Ans=26=>K+0.5->K
IfEnd.
I need this fuction to work while pressing the keys.
If I press the numbers it should ask for the "KM" value and then should display the result.
Pls help.
- flyingfisch
-
- Posts: 89
- Joined: Thu Apr 05, 2012 3:16 pm
- Location: Akron, OH, USA
- Calculators: Casio fx-9750GII, Casio fx-CG10
nagarajan wrote:Hi,
Am having a trouble with getkey.
Here's my code:
"KM"?->K
Do:Getkey
LpWhile Not Ans
If Ans>=25
Then Ans=76=>K+0.01->K
Ans=66=>K+0.02->K
Ans=56=>K+0.05->K
Ans=46=>K+0.1->K
Ans=36=>K+0.2->K
Ans=26=>K+0.5->K
IfEnd.
I need this fuction to work while pressing the keys.
If I press the numbers it should ask for the "KM" value and then should display the result.
Pls help.
This is better, i think... but I don't think I really understand what you want to do
- Code: Select all
Do
LpWhile not Getkey
If Ans>=25
Then Ans=76=>K+0.01->K
Ans=66=>K+0.02->K
Ans=56=>K+0.05->K
Ans=46=>K+0.1->K
Ans=36=>K+0.2->K
Ans=26=>K+0.5->K
IfEnd.
"KM" -> K
- nagarajan
- Member
- Posts: 48
- Joined: Mon Apr 23, 2012 3:58 am
- Location: Chennai,India
- Calculators: Casio fx-9750GII, Casio fx-9860G Slim, Casio fx-9860GII
flyingfisch wrote:This is better, i think... but I don't think I really understand what you want to do
- Code: Select all
Do
LpWhile not Getkey
If Ans>=25
Then Ans=76=>K+0.01->K
Ans=66=>K+0.02->K
Ans=56=>K+0.05->K
Ans=46=>K+0.1->K
Ans=36=>K+0.2->K
Ans=26=>K+0.5->K
IfEnd.
"KM" -> K
Thanks for the idea.
What i need is:
1.Inputting K value.
2.After the input it should keep on adding .01,.02,.05,.1,.2 etc while pressing the keys assigned to the function.
3.If the keys were not pressed it should return to asking the value of K.
Hope this 'll help you to solve my problem.
nagarajan wrote:Hi,
Am having a trouble with getkey.
Here's my code:
"KM"?->K
Do:Getkey
LpWhile Not Ans
If Ans>=25
Then Ans=76=>K+0.01->K
Ans=66=>K+0.02->K
Ans=56=>K+0.05->K
Ans=46=>K+0.1->K
Ans=36=>K+0.2->K
Ans=26=>K+0.5->K
IfEnd.
I need this fuction to work while pressing the keys.
If I press the numbers it should ask for the "KM" value and then should display the result.
Pls help.
The user input "MK" value and press EXE to validate. So the GetKey juste after return obviously 31 (EXE).
You must wait until the button is released. (While Getkey:WhileEnd)
- nagarajan
- Member
- Posts: 48
- Joined: Mon Apr 23, 2012 3:58 am
- Location: Chennai,India
- Calculators: Casio fx-9750GII, Casio fx-9860G Slim, Casio fx-9860GII
PierrotLL wrote:The user input "MK" value and press EXE to validate. So the GetKey juste after return obviously 31 (EXE).
You must wait until the button is released. (While Getkey:WhileEnd)
Can you explain this with the sample code pls?
- aapman55
- Senior Member
-
- Posts: 66
- Joined: Sun Apr 15, 2012 4:00 pm
- Calculators: Casio fx-9860G
- Code: Select all
"KM"?->K
Lbl 1
Do
For 1->A To 75:Next
Getkey
LpWhile Ans=0
Clrtext
Locate 1,1,K
Ans=79=>K+0,02->K
Ans=47=>Goto Q
Goto 1
Lbl Q
ClrText
Locate 4,5,"Quit"
Play around with this working program.
- Code: Select all
"KM"?->K
While GetKey:WhileEnd [color="#008000"]//wait while a key is pressed[/color]
Do:Getkey
LpWhile Not Ans
Ans=76=>K+0.01->K //your If statement was useless
Ans=66=>K+0.02->K
Ans=56=>K+0.05->K
Ans=46=>K+0.1->K
Ans=36=>K+0.2->K
Ans=26=>K+0.5->K
@aapman55 : your code will slow-down the program on old calcs, and the result will be wrong if the user press EXE a long time. A simple While is better.
9 posts
• Page 1 of 1
Return to Casio Basic Development
Who is online
Users browsing this forum: No registered users and 5 guests