# Thread: Alittle help please

1. ## Alittle help please

Hi there!

can anyone help me or point me in the right direction,

i am trying to code a calculator that will except floating point numbers upto 6 digits, including the decimal point...

would i need a string to check each of the numbers to make sure the dont go over 6 digit limit??

Thanks in advance

2. Well both the scanf functions and cin have support for doing precision. But you could preprocess a string if you really wanted to.

Alittle help please as a title is bad form, btw. Many people disreguard questions with this title.
[/edit]

3. all i know is use double for floating point #

like this:

void main()
{
double n1, n2, n3
}
then just program them in.

try something like

if(n1 = > 6)

hope it helps

4. You need to use a string to read the number, then convert it to a double when you've checked it for length.

5. A little help please isn't a good name i suggest some random marks like this \$&^%\$%(&%\$^#\$\$^&*%(^%^(&%

6. Keep multiplying the number * 10 until there is no decimal point
Code:
```while(int(num)!=num)
{
num*=10;
}```
Then if this number divided by one million is less than zero then the original is 6 digits or less else it isn't.

PS. I *think* this works but I haven't tested it!

7. Yes, we all know the thread title isn't the best choice, hopefully boontune will choose more wisely next time.

@master2000
void main() is wrong, please don't promote its use.
And please do not make further posts like this one:
A little help please isn't a good name i suggest some random marks like this \$&^%\$%(&%\$^#\$\$^&*%(^%^(&%
I suggest you read the forum guidelines. Any questions, PM me.

8. Thanks alot for your help guys,

Im sorrry about the heading, i will rethink it next time

Cheers again!

9. Originally posted by Hammer
Yes, we all know the thread title isn't the best choice, hopefully boontune will choose more wisely next time.

@master2000
void main() is wrong, please don't promote its use.
And please do not make further posts like this one:

I suggest you read the forum guidelines. Any questions, PM me.
sorry

also i always use void main()

10. Originally posted by boontune
Thanks alot for your help guys,

Im sorrry about the heading, i will rethink it next time

Cheers again!

just add the word baloonies

11. I usually use float main().

12. what do you use it for?

13. >what do you use it for?
i usually use it when i want to brush up on my bad programming habbits. void main() also helps with those.

14. how does that cure habits?????????

--shish--

void main() curing habits

--god help this kid--

Popular pages Recent additions