Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that prompts the user to enter the name of a file. The programfinds the anagrams in the file. Enter the file

Write a C program that prompts the user to enter the name of a file. The programfinds the anagrams in the file.

Enter the file name: words.txt

Output: anagrams are written to file: words.txt.ang

image text in transcribed

The program reads the content of the oringinal file(in this case words.txt found above) and stores the words in an array of strings, the program then finds the anagrams andwrites the anagrams to the output file.

1. Name your program fileIO.c. The output file name should be the same name as the input file but with an added extension of .ang. In this example, the original file name is words.txt. The output file name is thenwords.txt.ang. Assume the file name is no more than 100 characters. Assume the length of each line in the input file is no more than 100 characters. Assume the input file contains no more than 1000 words.

2. The following function is provided in anagram.c found below:

int are_anagram(char *word1, char *word2);

image text in transcribed

image text in transcribed

word1 and word2 are strings containing the words to be checked for anagram. The function returns 1 if the two words are anagrams of each other and return 0 otherwise.

3. The output file should be in the following format. The output file contains all the anagrams.

1 inch

chin

2 roast beef

eat for BSE

...

words - Notepad File Edit Format View Help rail safety inch roast beef eat for BSE William Shakespeare Madam Curie lake morning Radium came I am a weakish speller Heir hire computer science chin knee array length leak kiss

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago