i want solve this problems ??

Pages: 12
It certainly does happen too often but face it, it's impossible to police the forums on that level. Plus, it's just human nature to try and help people when you can. Especially if it represents an opportunity to show off your newly learned skills. At least timmy already understands (@ only 14 posts) that it's hurting more than helping to spoon-feed answers.

This does not mean that you can't help. Just help in a way that makes the person think for themselves so they develop the critical thinking skills required to be a good programmer. bl4ckb3rry's response was useless at anything other than helping another person cheat. No explanations, not even a single comment in the code. What was the point???
thx ... very thx for all ...

but this programs can't solve it. and i begin learn this language .

and i try solve much of program only .

please ... can one solve this function i write ??

thx
I can try to describe how you could build it, because they'll... crucify me if I post code...

1. include <math.h> or <cmath>, either one works.
2. have a function you may call CountDigits that take an int, let's call it Number.
3. have a variable called _at
4. have a while loop that checks the equation Number / 10^_at > 1 and increase _at by 1 until the equation reaches a value below 1 and thus break the loop.
5. return _at

in the main function (int main()) write cout << CountDigits(your number of choise) << endl;

This is a bit vague, but it's perhaps as far as I can go ... or too far?

A programmer is an engineer, once you hear your assignement or task, your brain should think of ways to solve it, not strictly in code though. How would you do it by math given that you can't count the digits? Or how can you make your program count the digits in the numbers as a string?
Last edited on
GisleAune the answer to this problem has already been posted. We've also already told him that he just needs to use the string libraries length() function.

He's now trying to solve this: "* write a function named "digit_name"that takes an integer argument in the range from 1 to 9 , inclusive , and prints the English name for that integer on the computer screen . The function should nor return a value . if the argument is not in the required range, then the function should print "digit error" . Thus, for example , the statement digit_name(7); should print seven on the screen ; the statement digit_name(0); should print digit error on the screen .. ???????"

For the second time I recommend you research switch statements.
Last edited on
thx .. GisleAune ..

i will try now solve this program .. and write my solve ... and wait your comments ..

thx..
"Help" does not include solving the problem FOR them. "Help" entails giving them the instruction they require to complete the task themselves. He won't gain anything by having us give him the code for all his homework, and it will just perpetuate the steady stream of bad programmers coming out of colleges these days.
Hint: std::string array[10] for your digit name problem.
Last edited on
@packetpirate, fortunately the bad programmers aren't the ones that get hired :-)
That's why we try to cast bad_programmers to good_programmers :)
Unfortunately that fails as often as not, so they generally get away from writing code...via promotion to management positions. :/
Sadly a dynamic_cast<good programmer>(bad programmer); only remains for that expression. If only we could permanently convert a variable :-(
I think some businesses just need some exception handling.
@ascii

Error:

No suitable conversion from bad_programmer to good_programmer.
Last edited on
1
2
good_programmer *___ = reinterpret_cast<good_programmer*>(new bad programmer);
//As long as we never *___ we're in the clear! 
Topic archived. No new replies allowed.
Pages: 12