The Gateway to Computer Science Excellence
0 votes
    int vowels=0;
    int cons=0;
[aeiouAEIOU] {vowels++;}
[a-zA-Z] {cons++;}
int yywrap()

return 1;
int main( )
 printf("Enter the end press^d\n");
 printf("No of vowels = %d \n No of consonants = %d\n",vowels,cons);
 return 0;

when i run this program in ubuntu . iam able to enter the string but it does print the line for counting vowels and consonants
in Compilers, Architecture, HPC by (21 points) | 103 views
Is your question is

No.of Consonants is printing wrong?
0 prints nothing ,i can only enter the string

how u dry running it?
in my B.Tech, i write more lex programs, from that experience i am running it...

He made mistake in Forming Regular Expression for Consonants.

But i am not getting why this code is doesn't give any output...

It should atleast print "No.of Vowels" etc...

right now, I didn't have lex compiler.. that's why i am not able to answer it.

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,833 questions
57,723 answers
107,778 users