Calculator, with a twist?

Discussion in 'iOS Programming' started by froggyfrance, Apr 16, 2010.

1. froggyfrance macrumors newbie

Joined:
Apr 16, 2010
#1
Hi guys,

Just a really quick question.

Say i want to make so that when someone enters a number *30* that translates into another number *5*

So if you drive 30km's that equates to "x" amount of carbon.

Thanks guys, any help is much appreciated.

(School projects )

2. miles01110 macrumors Core

Joined:
Jul 24, 2006
Location:
The Ivory Tower (I'm not coming down)
#2
What are you actually asking? This can be done with a simple multiplication by a constant.

3. froggyfrance thread starter macrumors newbie

Joined:
Apr 16, 2010
#3
Hard to think outloud.

Basically, i want it so that 1 = 0.65 or something, so that when the user inputs 3 say a bar next to it displays 1.95.

If that makes sense

Staff Member

Joined:
Sep 2, 2004
Location:
The Centennial State
#4
Code:
`float newValue = oldValue * 0.65;`
??

5. froggyfrance thread starter macrumors newbie

Joined:
Apr 16, 2010
#5
Thanks!

But being a COMPLETE newbie to this, where would i input that into the code?

And how does it actually work, but much thanks for the reply.

6. miles01110 macrumors Core

Joined:
Jul 24, 2006
Location:
The Ivory Tower (I'm not coming down)
#6
Uh.... it seems you are doing this backwards. I think you should read up on whatever language you're trying to write your code in and then ask more specific questions (or better yet, try to figure them out for yourself first) as they arise.

Staff Member

Joined:
Sep 2, 2004
Location:
The Centennial State
#7
If you're really a complete newb, it's time to step away from the real coding and go learn the basics of Objective-C, or even programming in general.