Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Description: This small but slightly useful program
- calculates how long a int is in characters which can
- be useful for spacing of graphs outputted in plain text.
- */
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[])
- {
- int in = 0;
- int out = 0;
- cout << "Please input a number:";
- cin >> in;
- while(1)
- {
- if(in >= 10)
- {
- in /= 10;
- out++;
- }else{
- out++;
- break;
- }
- }
- cout << out;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement