#include<stdio.h>
#include<time.h>
/*
The C library function clock_t clock(void) returns the number
of clock ticks elapsed since the program was launched.
To get the number of seconds used by the CPU, you will
need to divide by CLOCKS_PER_SEC.
*/
int main() {
clock_t start, end;
double total;
int i,j;
start = clock();
int c;
for (i = 0; i < 100; i++) {
for (j = 0; j < 100; j++) {
c++;
}
}
end = clock();
printf("start = %d, end = %d\n", start, end);
printf("\nTotal = %ld",end-start);
return 0;
}
%{
#include<stdio.h>
int vcount=0,ccount=0;
%}
%%
[a|i|e|o|u|E|A|I|O|U] {vcount++;}
[a-z A-Z (^a|i|e|o|u|E|A|I|O|U) ] {ccount++;}
%%
int main()
{
yylex();
printf("No. of Vowels :%d\n",vcount);
printf("No. of Consonants :%d\n",ccount);
return 0;
}
/* To Compile :
1) lex FileName.l
2) gcc lex.yy.c -ll
3) ./a.out
Type String and then press ctrl+D to get the result.
*/
You must be logged in to post a comment.