Task 5: Unscramble You will write a program that takes in 2 files: a dictionary file and a file listing jumbled words. Your binary will be called unscramble and will be run using unscramble The file contains a bunch of scrambled words, one word per line. Your job is to print out these jumbles words, 1 word to a line. After each jumbled word, print a list of real dictionary words that could be formed by unscrambling the jumbled word. The dictionary words that you have to choose from are in the file. As an example, the starter package contains two sample input files and the result should look as follows. The order that you display the dictionary words on each line can be different; however, the order that you print out the jumbled words should be identical to the order in your input. The sample out below is skipping a few lines to save handout space (your output must not omit these lines). nwae: wean anew wane eslyep: sleepy rpeoims: semipro imposer promise ettniner: renitent ahicryrhe: hierarchy dica: acid cadi caid dobol: blood nyegtr: gentry cukklen: knuckle

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Task 5: Unscramble
You will write a program that takes in 2 files: a dictionary file and a file listing jumbled words. Your
binary will be called unscramble and will be run using
unscramble <dictionary> <jumbles>
The <jumbles> file contains a bunch of scrambled words, one word per line. Your job is to print out
these jumbles words, 1 word to a line. After each jumbled word, print a list of real dictionary words that
could be formed by unscrambling the jumbled word. The dictionary words that you have to choose
from are in the <dictionary> file. As an example, the starter package contains two sample input files
and the result should look as follows. The order that you display the dictionary words on each line can
be different; however, the order that you print out the jumbled words should be identical to the order in
your input. The sample out below is skipping a few lines to save handout space (your output must not
omit these lines).
nwae: wean anew wane
eslyep: sleepy
rpeoims: semipro imposer promise
ettniner: renitent.
ahicryrhe: hierarchy
dica: acid cadi caid
dobol: blood
nyegtr: gentry
cukklen: knuckle
Homework 2
warllc: NO MATCHES
addej: jaded
baltoc: cobalt
mycall: calmly
dufil: fluid
preko: poker
lines omitted ..
milit: limit
pudmy: dumpy
hucnah: haunch
genjal: jangle
4
System Skill
(When a word doesn't unscramble to any dictionary word, you'll say "NO MATCHES" as shown in
the example above.)
Logistics: Your code should follow good programming style. This includes writing each logical unit of
code in a self-contained function that is not too long. We're a little impatient: On the sample input, we
are willing to wait only up to around 3 seconds on Hamachi.
The sample files can be found in the handout directory (see the beginning of this handout).
Code and Compilation: Your code will be one standalone file called unscramble.c. Use the following
command to generate an executable unscramble. Your code must compile clean with this command.
gcc -Wall -W -pedantic -o unscramble unscramble.c
ASSUMPTIONS: For ease, you can assume that no words are longer than 50 letters and the dictionary
file contains no more than 500,000 words.
TIPS: You should observe that a word s unscrambles to a dictionary word w if when you sort the letters
of s lexicographically and similarly sort the letters of w, they result in the same sequence of letters. For
example, sorted ("eslyep") is eelpsy, which is the same sorted ("sleepy"). Furthermore, it is
easy to sort an array (or a string-i.e., an array of characters) using the built-in function qsort.
Transcribed Image Text:Task 5: Unscramble You will write a program that takes in 2 files: a dictionary file and a file listing jumbled words. Your binary will be called unscramble and will be run using unscramble <dictionary> <jumbles> The <jumbles> file contains a bunch of scrambled words, one word per line. Your job is to print out these jumbles words, 1 word to a line. After each jumbled word, print a list of real dictionary words that could be formed by unscrambling the jumbled word. The dictionary words that you have to choose from are in the <dictionary> file. As an example, the starter package contains two sample input files and the result should look as follows. The order that you display the dictionary words on each line can be different; however, the order that you print out the jumbled words should be identical to the order in your input. The sample out below is skipping a few lines to save handout space (your output must not omit these lines). nwae: wean anew wane eslyep: sleepy rpeoims: semipro imposer promise ettniner: renitent. ahicryrhe: hierarchy dica: acid cadi caid dobol: blood nyegtr: gentry cukklen: knuckle Homework 2 warllc: NO MATCHES addej: jaded baltoc: cobalt mycall: calmly dufil: fluid preko: poker lines omitted .. milit: limit pudmy: dumpy hucnah: haunch genjal: jangle 4 System Skill (When a word doesn't unscramble to any dictionary word, you'll say "NO MATCHES" as shown in the example above.) Logistics: Your code should follow good programming style. This includes writing each logical unit of code in a self-contained function that is not too long. We're a little impatient: On the sample input, we are willing to wait only up to around 3 seconds on Hamachi. The sample files can be found in the handout directory (see the beginning of this handout). Code and Compilation: Your code will be one standalone file called unscramble.c. Use the following command to generate an executable unscramble. Your code must compile clean with this command. gcc -Wall -W -pedantic -o unscramble unscramble.c ASSUMPTIONS: For ease, you can assume that no words are longer than 50 letters and the dictionary file contains no more than 500,000 words. TIPS: You should observe that a word s unscrambles to a dictionary word w if when you sort the letters of s lexicographically and similarly sort the letters of w, they result in the same sequence of letters. For example, sorted ("eslyep") is eelpsy, which is the same sorted ("sleepy"). Furthermore, it is easy to sort an array (or a string-i.e., an array of characters) using the built-in function qsort.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education