Răspuns:
#include <iostream>
#include <cstring>
using namespace std;
char s[256], cifre[]="0123456789";
bool verif(char s[], int n)
{
if (n==0)
{
return strchr(cifre,s[0]);
}
else
{
if (!(strchr(cifre,s[n]))) return false;
else verif(s,n-1);
}
}
int main()
{
cin.getline(s,256);
int k=strlen(s);
--k;
if (verif(s,k)) cout << "Sirul e format numai din cire";
else cout << "Sirul nu e format numai din cifre";
}
Explicație: