Answer to Question #180323 in C++ for Shivam Prakash

Question #180323

write a 

program which will accept one 

integer argument and returns 

count of digits of that argument 

using (((class to basic conversion.))))


1
Expert's answer
2021-04-11T11:08:28-0400
#include <bits/stdc++.h>
using namespace std;

void count_digits(int n)
{
    string num = to_string(n);
 
    cout << num.size() << endl;
}
int main()
{
    int n = 345;
    count_digits(n);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS