write a function that takes an integer value and returns the number of digits,
for example given the number 7631, the function should return 4.
write a function that takes an integer value and returns the number of digits,
for example given the number 7631, the function should return 4.
What idea do you have that you think you could implement to solve this problem?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
i only need the function not the whole program baby
That does not change anything. Refer to the homework policy.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Where in your post are you actually asking a question?
Oh wait, you are probably one of those lazy ass bastards with delusions of godhood that expects us, your loyal subjects, to follow your every command.
Well, to clarify things for you, you are not god, and we are not your subjects. Now, go back to your dark little basement and do your own homework. And don't bother asking mummy for cookies, because you won't get any until you put in some effort into solving your problem.
iMalc: Your compiler doesn't accept misspellings and bad syntax, so why should we?
justin777: I have no idea what you are talking about sorry, I use a laptop and there is no ascii eject or something
We have no idea what type of individual the OP is, so let's stop making assumptions. laserlight already pointed ou the homework policy.
Now, if the OP wants some help, he/she can read the homework policy and post an attempt that shows that he/she has actually put some effort into this, or intend to. Otherwise, we won't help. Simple as that.
No need to throw around insults.
iMalc: Your compiler doesn't accept misspellings and bad syntax, so why should we?
justin777: I have no idea what you are talking about sorry, I use a laptop and there is no ascii eject or something
iMalc: Your compiler doesn't accept misspellings and bad syntax, so why should we?
justin777: I have no idea what you are talking about sorry, I use a laptop and there is no ascii eject or something
And some might not. I don't consider the first one rude.
The second is a little ambiguous. I cannot tell the individuality of someone from merely two replies.
Insane is subjective. Plus I usually don't direct them as insults against people. So really they aren't rude...Then again, some might consider your inane pro-C++ rants rude (actually, I find those quite amusing).
Agreed, that's why I don't consider them rude.Plus I usually don't direct them as insults against people. So really they aren't rude.
iMalc: Your compiler doesn't accept misspellings and bad syntax, so why should we?
justin777: I have no idea what you are talking about sorry, I use a laptop and there is no ascii eject or something
Here's a thought. Keep dividing the number by 10 until it goes to zero.
7631/10 = 763
763/10 = 76
76/10 = 7
7/10 = 0
all you have to do is put the number into a string, then print the string.length() function.
string number;
getline(cin, number);
cout << number.length();