상세 컨텐츠

본문 제목

C Program Search Word

카테고리 없음

by lebirthreca1973 2020. 3. 1. 10:50

본문

C program search word search

Windows Search Programs

Problem: Write a Lex program to search a word in a file.Explanation:is a tool/computer program for generating lexical analyzers (scanners or lexers) written by Vern Paxson in C around 1987. Lex reads an input stream specifying the lexical analyzer and outputs source code implementing the lexer in the C programming language. The function yylex is the main flex function which runs the Rule Section.Examples: Input: welcome to geeksforgeeksOutput: welcomeFOUNDforNOT FOUNDgeeksforgeeksFOUNDApproach:To search a word, I have stored words in file named “input.txt” and used lex to receive words from keyboard. On receiving each word, I check it with the words in the file.

If the word is found, the program prints “FOUND” else “NOT FOUND”.Input File: input.txt (Input File used in this program)Below is the implementation of program.