Starting from:

$30

CSE102-Assignment 3 Solved

This is a C Programming assignment. You will write a C program according to the following description.

•     You are given a file(input1.txt) which contains a list of words(one word at a line).

•     You are given a file(input2.txt) which contains lines of character strings of various sizes.

•     Your program should read the given files (input1.txt and input2.txt) and for each word in input1.txt, find the location and the orientation in input2.txt.

•     Strings can appear vertically or horizontally. Once all the strings are found, your program should write their head position and the orientation to output.txt file.

•     The order of words in input1.txt and output.txt should match. (Ignore the missing words) • Some words may be missing in input2.txt. output.txt should not include the missing words.

Example
Contents of input1.txt:

Xanthos

Patara

Myra

Adana

Arycanda

Phaselis

Contents of input2.txt:

askjdkdanmowflfkadkjkaksdklskksadllasd fkfklsal;sdlslfsdkdfkMyraslfsfeokdlasdfdf wfewfPsdflsdfklsdosfkeowkfweofkwoefkkfsf sdfsdakjewofksdfoiwefjowefks;dfPhaselissdfkefowefjksdlfjslfjsldfj oefkwtifjslflsdfkjeifjsl;asldkiefjiefjlskfdjeifjksk sdlfkawioAjksdlfkeifsflkefjiwfejsllfjeighghj;wp dfkjerwfjr;s;dlskfjfiefwflwekfjwlefiehgwefjiw sdfkkafwXanthosdkfjlsAfdjiefeiwowefwefiefjowiefehgl;lewofjefw iieoefnFGSAiejfiwefjhrwefiiwejfiwjefihhwefklskdf skkfjwifjwiiwifieifwfy[pwpfjwifwefijijwhi]

sdfijwiefjiwhiwiejfiwcifjweofi;aiajdijeifwuiefhwoeifjowehi iiwefiwefjwiefjwiefjiajiefiiwejflkajsdlkjfiewhfiwefjowiefhhaskjlskdfu iwjefijefmmiewifjweifnklksjdiaifwefpwefijfiwfOWOEFIEWfnweiuf jfnwefiwfpwfjiejfiwefdjwflljfwiefjiwefwflijijfiewfhu kkfiefiewpfkfjfjhewfoawefkwoefoejwfowoefkowefkowo output.txt:

Xanthos (8,9) Horizontal Patara (3,6) Vertical Myra (2,22) Horizontal

Arycanda (8,22) Vertical Phaselis (4,32) Horizontal

Remarks:

•     For input2.txt, strings which correspond to rows are separated by whitespace.

•     For input2.txt, Maximum length of each row is 250

•     For input2.txt, Maximum number of rows is 100 • Position indices start from 1.

•     For input1.txt, there is no limit on the number of words.

•     For input1.txt, maximum word length is 10 characters.

•     You don’t have to do error checking on the input file. You can safely assume that you will be given a proper input file which doesn’t violate the described format.

•     Be careful with the size of the array you allocate in program stack. Large arrays may not fit in program stack(stack size may be smaller on the test machine) and your program crashes.

•     Make sure you can read input files with or without a tailing newline at the end. (If you are using a windows machine, newline is CRLF, on unix it is LF). You can alter this using advanced editors (i.e. Visual Studio Code). Test your code for every possible combination.

More products