Tuesday, 3 December 2013

Count the number of signed numbers using Flex [ lex program part 8 ]


PROGRAM

       

%{
int c=0;
%}
str [-|+][0-9]*
%%

{str} c++;

%%

void main()
{
int b;
printf("Enter a the number \n");
yylex();
printf("number of signed numbers are %d \n",c);

}
        
    

OUTPUT

   

lex cns.l
cc lex.yy.c -lfl
./a.out
        
    
 then press CTRL+d

0 Comments:

Post a Comment

Facebook Twitter Delicious Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | coupon codes