Advertisement
Guest User

Untitled

a guest
May 26th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. //Jack Green
  2.  
  3. #include "stdafx.h"
  4. #include <iostream>;
  5. #include <ctime>;
  6.  
  7. using namespace std;
  8.  
  9. //Declare variables
  10. int value = 0, divider = 1, valuecopy = 0, digits = 0;
  11.  
  12. void main()
  13. {
  14.     //Introduction
  15.     cout <<"Please enter the number: ";
  16.     cin >> value;
  17.  
  18.    
  19.     //Calculation
  20.     for(int temp = 0; temp < 1; temp++)
  21.     {
  22.         valuecopy = value;
  23.         if((valuecopy / divider) >= 1)
  24.         {
  25.             digits++;
  26.             divider *= 10;
  27.             temp--;
  28.         }
  29.     }
  30.  
  31.     cout <<value<<" is "<<digits<<" digits long."<<endl;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement