The leftmost digit when there is no given number

I know how to give the leftmost digit when i am already given a number but when there has to be a random number entered into the cin space, i am not sure how to do it. I know to find leftmost of a three digit number you modulus it by 100. Here is some of my code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
using namespace std;
int main()

{int a,b;

cout << "Please enter a 3-digit number." << endl;
cin >> a;
if (a ==100 || a> 100)
{
	cout <<"" << endl;
	cin.get();
}
else
{
	cout << "Invalid input, please run the program again and enter a 3-digit number.";
	cin.get();
}


if (a % 2 == 1)
{
	cout << " The number is odd" << endl;
}

else
{
	cout << "The number is even" << endl;
	cin.get();
}

if (a%100 ==0)
{
	cout<< "The number is divisible by 100." << endl;
}
else
{
	cout<< "The number is not divisible by 100." << endl;
}

if(a %100 ==)
cin.get();
return 0;
}



A is the number that is going to be entered. I know it would look something like
if(number%100 == ?)
I put the question mark cause i dont know what i would put here.
I cant put leftmost because it says when i tried that leftmost is uninitialized
1
2
3
4
5
6
int left_most_digit( unsigned long long number )
{
    if( number < 10 ) return number ; // single digit number; return the digit
    else return left_most_digit( number/10 ) ; // return the left-most digit of the
                                               // digits except the last digit
}
Topic archived. No new replies allowed.