Help

Hello,

I don't know how to find the sentence with the least number of words, I figure out how to count the words, but I don't know how to use strlen and strcpy to find sentence with the least number of words. Hope someone can help! Here is the text of the assignment (I only need how to find a name with the least number of words):

Create a field of 'N' animal shelter names. Find a name with the least number of words and copy it to a string'AZN'. In the 'AZN' string, transform every second letter of the first word into a capital letter.
In the function 'ko' find the sum of ASCII codes of the changed string 'AZN'. In the function 'np' transform the sum of ASCII codes into a system with a base of 22. Create a 1D dynamic field 'Z' in which you will input the number of characters of every word from the 'AZN'.Print the name field, transformed 'AZN' string, newly created equivalent with a base of 22 and the 'Z' dynamic field.

void main()
{
char shelter[N][min],AZN[min];
int i,j,n,counter;

cout << "Enter the number of shelter: ";
cin >> n;
cin.ignore();

int *Z=new int [n];

for(i=0;i<n;i++)
{
cout << "Enter the name of the " << i+1 << ". shelter: ";
cin.getline(shelter[i],min);

counter=1;

for(j=0;j<strlen(shelter[i]);j++)
{
if(shelter[i][j]==' ')

counter++;

*(Z+i)=counter;

}
Topic archived. No new replies allowed.