Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  pr
Language: C/C++
Code:
const int size = 100;
const int numberOfLetters = 26;
void count(char [], int []);

int main()
{
     int counts[numberOfLetters],t,j,c;
     char s[size];
        cout<<"enter no of lines"<<endl;
        cin>>t;
      if(t<=100)

       {
        for(j=0;j<t;j++)
        {

     cout << "Enter a string: ";
     cin.getline(s, 'n');

     

     count(s, counts);

     for (int i = 0; i < numberOfLetters; i++)
     {
          if(counts[i]==s[i])
                c++;
        }
                if(c==numberOfLetters)
                cout<<"yes"<<endl;
                else
                cout<<"no"<<endl;
           }
          }
          return 0;

}

void count(char s[], int counts[])
{
     for (int i = 0; i < numberOfLetters; i++)
     {
          counts[i] = 0;
     }

     for (int i = 0; i < size; i++)
     {
          {
               s[i] = tolower(s[i]);
               counts[s[i] - 'a'] ++;
          }
     }     
}
          
Comments: