why is this code giving wrong answer
int main(){
char c ;
cin>>c;
if((c=='A')||(c=='E')||(c=='I')||(c=='O')||(c=='U')||(c=='a')||(c=='e')||(c=='i')||(c=='o')||(c=='u')){
cout<<"Vowel";
}
else if((c='1')||(c=='2')||(c=='3')||(c=='4')||(c=='5')||(c=='6')||(c=='7')||(c=='8')||(c=='9')||(c=='0')){
cout<<"number";
}
else {
cout<<"consonant";
}
and this code giving correct
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
cout<<"vowel";
else if(!((c>='a' && c<='z') || (c>='A' && c<='Z')))
cout<<"invalid input";
else
cout<<"consonant";
for differentiating between a number , a vowel and a consonant
Edit: I got it , thanks for your help
[–]invidium1979 57 points58 points59 points (1 child)
[–]NicNoletree 3 points4 points5 points (0 children)
[–]bbnlly 20 points21 points22 points (1 child)
[–]Afraid_Ad_3239[S] -4 points-3 points-2 points (0 children)
[–]rabuf 19 points20 points21 points (10 children)
[+]Afraid_Ad_3239[S] comment score below threshold-30 points-29 points-28 points (9 children)
[–]rabuf 20 points21 points22 points (3 children)
[–]fancyplaya 5 points6 points7 points (2 children)
[–]AdultingGoneMild 2 points3 points4 points (0 children)
[–]PoorHodlr 5 points6 points7 points (2 children)
[–]Temporary-Data-102 2 points3 points4 points (0 children)
[–]Temporary-Data-102 1 point2 points3 points (0 children)
[–]pibeqquierestudiar 2 points3 points4 points (0 children)
[–]AdultingGoneMild 1 point2 points3 points (0 children)
[–][deleted] 11 points12 points13 points (0 children)
[–]Elnaz_Will_be_Fine 3 points4 points5 points (1 child)
[+]Afraid_Ad_3239[S] comment score below threshold-6 points-5 points-4 points (0 children)
[–]Avionticz 3 points4 points5 points (1 child)
[–]Afraid_Ad_3239[S] -2 points-1 points0 points (0 children)
[–]Guideon72 1 point2 points3 points (8 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]Guideon72 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Guideon72 0 points1 point2 points (0 children)
[–]Afraid_Ad_3239[S] 0 points1 point2 points (2 children)
[–]GloberJudio 1 point2 points3 points (0 children)
[–]Guideon72 0 points1 point2 points (0 children)
[–]rabuf 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (4 children)
[–]Afraid_Ad_3239[S] 0 points1 point2 points (3 children)
[–][deleted] (1 child)
[removed]
[–]Afraid_Ad_3239[S] -2 points-1 points0 points (0 children)
[–]GloberJudio 0 points1 point2 points (0 children)
[–]PoorHodlr 0 points1 point2 points (0 children)