Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Jack Green
- #include "stdafx.h"
- #include <iostream>;
- #include <ctime>;
- using namespace std;
- //Declare variables
- int value = 0, divider = 1, valuecopy = 0, digits = 0;
- void main()
- {
- //Introduction
- cout <<"Please enter the number: ";
- cin >> value;
- //Calculation
- for(int temp = 0; temp < 1; temp++)
- {
- valuecopy = value;
- if((valuecopy / divider) >= 1)
- {
- digits++;
- divider *= 10;
- temp--;
- }
- }
- cout <<value<<" is "<<digits<<" digits long."<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement