Răspuns:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{int x,c,n,y,p;
cout<<"x="; cin>>x;
y=x; n=0;
while(x!=0)
{c=x%10;
n=n+1;
x=x/10;
}
p=pow(10,(n-1));
if(n<=8) cout<<"Prima cifra a lui" <<y<< "este:"<<(y/p)<<endl;
else cout<<"Numarul are peste 8 cifre"<<endl;
return 0;
}