Problem with array

Someone help me in my program?
The only word appear is "Enter a sentence" as i enter the sentence,it didnt count the vowels,consonants, etc.

Here it is

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
char name[150];
int i,v,c,s,w,sc;
i=v=c=s=w=sc=0;
cout<<"Enter a sentence: ";
cin.getline(name,150);
for(i=0;name[i]!='\0';i++);
{
if(name[i]=='a' || name[i]=='e' || name[i]=='i' || name[i]=='o' || name[i]=='u' || name[i]=='A' || name[i]=='E' || name[i]=='I' || name[i]=='O' || name[i]=='U')
cin>>v;
else if((name[i]>='a'&& name[i]<='z') || (name[i]>='A'&& name[i]<='Z'))
cin>>c;
else if (name[i]==' ')
cin>>s;
else if (name[i]= ' ' || name[i] == '\0' && name[i+1] != ' ')
cin>>w;
else if (name[i] != c && name[i] != v && name[i] != w && name[i] !=s)
cin>>sc;
}
cout<<"There is/are "<<v<<" vowel(s), "<<c<<" consonant(s) and "<<sc<<" symbol(s)";
cout<<"\nIn the given sentence, it contains "<<w<<" word(s) and "<<s<<" space(s";

_getch();
return 0;
}

Try the following change
cin >> v;
cin >> c;
cin >> s;
cin >> w;
cin >> sc;

into:
v++;
c++;
w++;
sc++;

Edit:

and you have a semi colon after your for loop argument, remove that.
Last edited on
Topic archived. No new replies allowed.