Assignment Chef icon Assignment Chef

[SOLVED] Assignment 5 csc250

5.0 1 customer review Digital download

Digital download

$25.00

Availability
In stock
Checkout
One item

Need a hand?

Message us on WhatsApp for payment or download support.

WhatsApp QR code

Write a program that determines if two strings (words) are anagrams. The function (anagrams) should not be case-sensitive and should disregard any punctuation or spaces. Two strings are anagrams if the letters can be rearranged to form each other. For example, “state” is an anagram of “taste.” Each string contains one “s,” two “t’s,” etc. Test your function with several words that are anagrams and non-anagrams.

You must write the corresponding anagrams c file for the following anagrams.h file:
int anagrams (char str[], char strstr[]);

Your anagrams.c file must also work with the following main.c file:
#include
#include // for exit(1)
#include “anagrams.h”

int main(int args, char *argv[])
{
if (args == 3)
{
int ans = anagrams(argv[1], argv[2]);
if (ans) // anagrams
{
printf(“%s is an anagram of %s”, argv[1], argv[2]);
}
else
{
printf(“%s and %s are not anagram of each other”, argv[1], argv[2]);
}
} // end if

else
{
printf(“usage: ./a.out string1 string2 ”);
exit(1);
}
return 0;

Requirements:

– You are NOT allowed to use any predefined C function (string.h functions).
– You must write an appropriate Makefile

To submit your PDF and Java files on Moodle:

1. Create a folder with your last name.
2. Place your c file(s), header file(s) and makefile inside the folder.
3. Zip the folder.
4. Upload it to Moodle.

Sample Run:

./a.out State Taste

State is an anagram of Taste

./a.out state stat
state and stat are not anagram of each other