Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
You are not logged in. Go to Login page. You need to login before you can view more content. (content omitted that requires login)
5. Song abstraction using arrays 1
6. Requirements
Write a C program to do the following.
Output the nursery rhyme as shown in the example input and output.
No functions or procedures or global variables or defines are to be used. That is for a future work.
No constants or pseudo-constants or defines are to be used. This is for a future work.
Do not use simple string variables for the differences in the song. Instead, use one array and index into that array to set and access that difference.
Separate the following, in order: declarations, input, processing, output.
The program should be general and not make unnecessary assumptions about the input.
If the requirements are unclear in any way, use any provided input and output to resolve the discrepancy.
The debugging output data is an integer on the first line of the input. It should be read without prompt or echo.
Only output using printf should be done in the body of a debugging conditional. (This includes any functions whose only effect is to do output using printf).
No compound conditionals, such as using && or nested conditionals should be used. They are not needed and complicate the use and understanding of this simple idea.
The code 0 means just the production output. No condition nor conditional is needed for this.
The code 1 means the production and processing output. Use the condition "> 0" (greater than zero) for the check.
The code 2 means the production and processing and input prompt and echo output. Use the condition "> 1" (greater than one) for the check.
All debugging output must be sequenced appropriately. The prompt should come immediately before the scanf and the echo should be immediately after the scanf.
8. Domain knowledge
Domain knowledge is the background knowledge that is useful in solving a problem, designing a solution, implementing the solution, etc. The following domain knowledge may be useful for this requirement.
The only domain knowledge needed is that of some children's nursery rhymes. The main use of the rhymes is so that there is no question what the output should be without even looking.
Note: In addition to specific domain knowledge, you should be familiar with all concepts covered to this point in the course.
9. Coding notes
The following coding examples and/or notes may be of use for this requirement.
Make all necessary assumptions. Make no unnecessary assumptions.
In addition to specific coding examples, you should be familiar with all concepts covered to this point in the course.
10. Starter program
You are provided with the following starter program in file songarrays1.c.
Do not remove any comment that starts with three slashes.
Here is the C code.
You are to fill in the missing parts of the program according to the work requirements (see above).
In the comments at the top, you are to fill in the author (your name), help received (person and type of help), and pseudo-code parts which are not in the solution (usually provided, but you need to add them). Remove the parentheses too.
11. Possible solution
Begin solution
Here is a possible solution to the above problem. Note: Once a solution is provided, or the day before the next class, further submissions for this work receive no credit.
End solution
12. Examples of input and output
Here are some examples of input and output for the above program code.
Here is an example input from file input1.txt.
For the above example input, here is the expected output.
Here is an example input from file input2.txt.
For the above example input, here is the expected output.
Here is an example input from file input3.txt.
For the above example input, here is the expected output.
13. Pseudo-code
Pseudo-code is a "false" code. It is not really code, but a simplified English explanation that is somewhat similar to code. Pseudo-code is useful for understanding what a program does. For this work, the following can be used as the pseudo-code. Adjust if needed.
Note: Only some essential details are included. Some details, such as input, prompts, input echo, and obviously needed output are omitted.
The best way to copy-paste pseudo-code that includes indented code (e.g., with tabs) is as follows (in the code file) using a multi-line comment.
/*
(pasted pseudo-code here)
*/
14. Scoring rubric
CS 101 - L11 : Lab#11: Songs with arrays 1
Your grade: _ / 20
[LATE] Late or redo penalty: _ / -20
[SUBMIT] Not submitted properly: _ / -20
[RUN] Does not compile, run-time crash, etc.: _ / -20
[ETHICS] Ethical issues: _ / -20
[HEADER] Header comments not done as required: _ / -10
[STYLE] Inconsistant style or indentation: _ / -10
[CODE] Code guidelines ignored: _ / -20
[XCODE] Code used not yet covered: _ / -10
[REMOVED] Triple slash comments removed: _ / -10
[ADDED] Code added outside of marked areas: _ / -10
[OUTPUT] Functional requirements met: _ / 20
[CREDIT] Extra credit: _ / +4
Comments: