coding in C

The purpose of this assignment is to practice your coding in C, using basic constructs such as functions,

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

loops, arrays, and strings. As well, you will be using several functions from the C standard library, which

will give you the opportunity to explore the Standard C Library.

A1
The purpose of this assignment is to practice your coding in C, using basic constructs such as functions,
loops, arrays, and strings. As well, you will be using several functions from the C standard library, which
will give you the opportunity to explore the Standard C Library.
This assignment is divided into three problems, where each problem builds on the next. Each problem
subsumes the previous one. Hence, if you complete Problem 3, you will have also completed Problem 2
and Problem 1.
Preparation:
1. Complete Assignment 0 or ensure that the tools you would need to complete it are installed.
2. Clone your assignment repository
where ???? is your CSID. Please see instructions in Assignment 0 and the tutorials on Brightspace if
you are not sure how.
Inside the repository there is a spellbee directory, in which the code is to be written. Inside this
directory there is a tests directory that contains tests that will be executed each time you submit your
code. Please do not modify the tests directory or the .gitlab-ci.yml file that is found in the root
directory. Modifying these files may break the tests. These files will be replaced with originals when the
assignments are graded. You are provided with a sample Makefile that can be used to build your
program. If you are using CLion, a Makefile will be generated from the CMakeLists.txt file
generated by CLion.
Background
The Spelling Bee1 game in the New York Times is a popular puzzle where players
are given seven letters and must come up with all words containing only those
letters, or a subset of those letters. Each instance of the puzzle has at least one
panagram, which is a word that contains seven distinct letters. The problem is
that creating new puzzles can be time-consuming. First, a panagram must be
found in the dictionary. Second, a list of words comprising only the letters from
the panagram must be generated. A good puzzle will typically have a word list of 20 to 60 words: Any
fewer and the puzzle becomes too easy. Anymore, and the puzzle takes too long to do.
You have been hired to save the New York Times time and money by writing a program to identify new
panagrams.
Problem 1: Find the Panagrams!
1 Spelling Bee, published by NY Times, (https://en.wikipedia.org/wiki/The_New_York_Times_Spelling_Bee)
Write a C program called spellbee, which reads in a list of words and determines which of these words
are panagrams (words that have 7 distinct letters). The program then outputs the panagrams in the order
that they appear in the input list.
Input
Your program will read its input from stdin. The first line contains a single integer denoting the number of
words (W) in the dictionary. This is followed by W lines, each containing a single word. All words will be
in upper-case letters. (Hint: Use scanf to read integers and words).
5
DEVIANT
FRUITION
PERFORMANCE
TUITION
VEXATE
In this example, FRUITION and DEVIANT are panagrams because they have 7 distinct letters. The others
are not panagrams: PERFORMANCE has 9 distinct letters, while TUTION and VEXATE have 5 distinct letters.
Processing
The program must identify all valid panagrams and print them out.
• No word will be longer than 29 characters.
• No other characters will be present.
• In this program there is no upper limit on W, the number of words. However, this is not an issue
as your program does not need to store the entire list of words.
Output
All output should be performed to stdout. The output must be exactly as specified. The output consists
of a list of panagrams, one per line.
Examples
Input
5
TUITION
DEVIANT
PERFORMANCE
VEXATE
FRUITION
Output
DEVIANT FRUITION
Problem 2: Letters, Please
Extend your spellbee from Problem 1 to handle one change. It would be useful for the puzzle creators
to have the 7 letters from each panagram listed in alphabetical order.
Input
The input format is the same as in Problem 1.
Processing
Same as problem 1, except that your program should identify the seven letters from each panagram and
output them after the panagram itself.
Output
For each panagram the following format is used:
P : C1 C2 C3 C4 C5 C6 C7
where P is the panagram and C1 , C2, C3, …, C7, are the seven letters of the panagram in alphabetical order.
Examples
Input
5
TUITION
DEVIANT
PERFORMANCE
VEXATE
FRUITION
Output
DEVIANT : A D E I N T V
FRUITION : F I N O R T U
Problem 3: Count the Words!
Extend your spellbee from Problem 2 to handle one more change. It would be useful for the puzzle
creators to know how many words in the dictionary can be composed from the letters of a panagram.
Input
The input format is the same as in Problem 1.
Processing
Same as problem 2, except that your program will need to store the list of words in memory to check which
words can be composed from which panagram. Note: A dictionary will not be of size greater than 20000
words. Once a panagram is identified, your program will need to loop through the list of dictionary words
and count how many of those words can be composed from the letters in the panagram. Output
For each panagram the following format is used:
P : C1 C2 C3 C4 C5 C6 C7 ; X
where P is the panagram, C1, C2, C3, …, C7 , are the seven letters of the panagram in alphabetical order, and
X is the number of words in the dictionary that can be composed from the panagram. Examples
Input
5
TUITION
DEVIANT
PERFORMANCE
VEXATE
FRUITION
Output
DEVIANT : A D E I N T V ; 1
FRUITION : F I N O R T U ; 2
Assignment Submission
Submission and testing are done using Git, Gitlab, and Gitlab CI/CD. You can submit as many times as you
wish, up to the deadline. Every time a submission occurs, functional tests are executed, and you can view
the results of the tests. To submit use the same procedure as Assignment 0.
Grading
If your program does not compile, it is considered non-functional and of extremely poor quality,
meaning you will receive 0 for the solution.
The assignment will be graded based on three criteria:
Functionality: “Does it work according to specifications?”. This is determined in an automated fashion by
running your program on a number of inputs and ensuring that the outputs match the expected outputs.
The score is determined based on the number of tests that your program passes. So, if your program
passes t/T tests, you will receive that proportion of the marks.
Quality of Solution: “Is it a good solution?” This considers whether the approach and algorithm in your
solution is correct. This is determined by visual inspection of the code. It is possible to get a good grade
on this part even if you have bugs that cause your code to fail some of the tests.
Code Clarity: “Is it well written?” This considers whether the solution is properly formatted, well
documented, and follows coding style guidelines. A single overall mark will be assigned for clarity. Please
see the Style Guide in the Assignment section of the course in Brightspace.
The following grading scheme will be used:
Task
100%
Functionality (20
marks)
Solution Quality
(20 marks)
Code Clarity
(10 marks)
Indentation,
formatting,
naming,
comments
80%
60%
40%
20%
Equal to the number of tests passed.
Appropriate
algorithms and data
structure are used
for all three
problems.
Code looks
professional and
follows all style
guidelines
Appropriate
algorithm and
data structures
used for Problem
1 and 2.
Code looks good
and mostly
follows style
guidelines.
Algorithm or data
Algorithm or
structure used for
data structure
Problem 1 and 2 are for Problem 1
functional but not
has major flaws.
appropriate.
Code is mostly
Code is hard to
readable and
read and follows
mostly follows
few of the style
some of the style guidelines
guidelines
An attempt
has been
made.
Code is
illegible
Hints and Suggestions



Start early. The sample solution is under 100 lines of code, but if this is you first time coding in C, it
will take a little longer. It took me about under an hour to write the solution, so expect at least 5 – 8
hours of work, if you do not have a lot of experience with C.
The Standard Library functions I found most useful are:
o Problem 1 and 2: scanf(), printf(), strlen(), memset().
o Problem 3: all above and strdup()
I found it helpful to create a couple helper functions. I recommend keeping all functions together in
your main.c, but having a couple helper functions will make your main() function simpler.
0%
Assignment Testing without Submission
Testing via submission can take some time, especially if the server is loaded. You can run the tests without
submitting your code by using the provided runtests.sh script. Running the script with no arguments
will run all the tests. Running the script with the test number, i.e., 00, 01, 02, 03, … 09, will run that specific
test. Please see below for how run the script.
Get your program ready to run
If you are developing directly on the unix server,
1. SSH into the remote server and be sure you are in the spellbee directory.
2. Be sure the program is compiled by running make.
If you are using CLion
1. Run your program on the remote server as described in the CLion tutorials.
2. Open a remote host terminal via Tools → Open Remote Host Terminal
If you are using VSCode
1. Run your program on the remote server as described in VSCode tutorials.
2. Click on the Terminal pane in the bottom half of the window or via Terminal → New Terminal
Run the script
3. Run the script in the terminal by using the command:
./runtest.sh
to run all the tests, or specify the test number to run a specific test, e.g. :
./runtest.sh 07
You will see the test run in the terminal window.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed with your coursework?
Get quality coursework help from an expert!