Advertisement
Five_NT

Listele cu numere pare

Dec 11th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. %{
  2. // Afisati doar listele care contin numere pare
  3. #include <stdio.h>
  4. %}
  5.  
  6. nrpar ([1-9][0-9]*)?[02468]
  7. literal ({nrpar},)+
  8. lista \<{literal}{1,}{nrpar}\>
  9.  
  10.  
  11. %%
  12. \<{lista}\> {ECHO;}
  13. .|\n
  14. %%
  15.  
  16. int main(int argc, char** argv){
  17.     if(argc > 0)
  18.         yyin = fopen(argv[1],"r");
  19.     yylex();
  20. }
  21.  
  22.  
  23.  
  24. /////////// fisier cu date
  25. <1,2,3,4>
  26. <2,4,6>
  27. <20, 22, 12, 2, 1112>
  28. <11, 12> <10> <01>
  29. <100> <101> <102> <112> <124> <120>
  30. <1111> <1234> <1220> <10001>
  31.  
  32. (1,2,3,4)
  33. (2,4,6)
  34. (20, 22, 12, 2, 1112)
  35. (11, 12) (10) (01)
  36. (1000) (101) (102) (112) (124) (120)
  37. (1111) (1234) (1220) (10001)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement