Hello Everyone,
My name is olams and i am new to this website and C++ in general. I am having real difficulty in this class.
Can someone please tell me how to find the number of digits in number using Visual C++. Net or C++.
I really need help. Any assistance is greatly appreciated.
Thanks
olams
2
Light Poster
Recommended Answers
Jump to PostAssuming the given number is an integer, try dividing it by 10...
int num_digits; if (myNumber < 0) myNumber = -myNumber; while(myNumber > 0) { num_digits++; myNumber/=10; }
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.