Răspuns :
Răspuns:
#include <iostream>
#include <cstring>
using namespace std;
char prop[256], *cuv, separator[]=" ";
int nrCifPare(char c[])
{
char pare[]="02468";
int contor=0;
for (int i=0; i<strlen(c); i++)
{
if (strchr(pare,c[i])) ++contor;
}
return contor;
}
int main()
{
cin.getline(prop,256);
cuv=strtok(prop,separator);
while (cuv)
{
cout << nrCifPare(cuv) << " ";
cuv=strtok(NULL,separator);
}
return 0;
}
Explicație:
#include <iostream>
#include <cstring>
using namespace std;
char p1[256], p2[256], voc[]="aeiouAEIOU", *cuv, separator[]=" ";
int contor;
int main()
{
cin.getline(p1,256);
cin.getline(p2,256);
cuv=strtok(p1,separator);
while (cuv)
{
if (isalpha(cuv[0]))
{
if (!(strchr(voc,cuv[0])))
++contor;
}
cuv=strtok(NULL,separator);
}
cout << contor << " ";
contor=0;
cuv=strtok(p2,separator);
while (cuv)
{
if (isalpha(cuv[0]))
{
++contor;
}
cuv=strtok(NULL,separator);
}
cout << contor << " ";
return 0;
}