Question: WRITE A C CODE. In this assignment, you will write a main() function that can process command line arguments parameters that are typed at the

WRITE A C CODE.

In this assignment, you will write a main() function that can process command line arguments parameters that are typed at the command line and passed into your program right when it starts running (as opposed to using scanf() to get input from a user after your program has already started running). Those parameters will be passed to your main() function as an array of strings, and so this program will also jog your memory with respect to using strings in C. On the software engineering side of things, you will learn to construct programs that use multiple source files and custom header (.h) files. This assignment will also help you hone your ability to acquire new knowledge by reading technical specifications. If you end up pursuing a career as a software developer, the ability to rapidly digest technical documentation and work with new software libraries will be absolutely critical to your work, and this assignment will provide you with an exercise in doing just that.

Finally, this assignment is specifically designed to require relatively few lines of code so that you can make your first foray into the world of Linux without a huge, unwieldy, and intimidating program to debug. As the semester progresses, the programming assignments will become more lengthy and complex, but for now, this assignment should provide you with a gentle introduction to a development environment and software engineering concepts that will most likely be quite foreign to you at first.

In this assignment, you will have to loop through an array of strings and print the last string in the array that is a duplicate of any other string in the array. For example, consider the following array of strings: { apple, banana, coconut, domination, apple coconut, banana, cake } Three of those strings are duplicates (i.e., they appear more than once in the array): apple, banana, and coconut. The very last string in the array that is a duplicate is banana. If this array were passed to your program, you would have to print banana to the screen (followed by a newline character). Also, if there are two consecutive occurrences of the string dupe anywhere in the array, you will print dupe dupe! (followed by a newline character) on a second, separate line of output. If there are no duplicates in the array your program is processing, youll simply print no dupey dupe :( to the screen (followed by a newline character). The strings you process will be passed to your program as command line arguments.

3. DupeyDupe.h (Super Important!) Your code for this assignment will go in a file named DupeyDupe.c. At the very top of that file, write a comment with your name, the course number, the current semester, and your NID. Directly below that, you must include the following line of code: #include "DupeyDupe.h" The quotes (as opposed to ) indicate to the compiler that this header file is found in the same directory as your source file, not a system directory. Note that filenames are case sensitive in Linux, so if you #include "dupeydupe.h" (all lowercase), your program might compile on Windows, but it wont compile when we test it. You must capitalize DupeyDupe.h correctly. The DupeyDupe.h file we have included with this assignment is a special header file that will enable us to grade your program. If you do not #include that file properly, your program will not compile on our end, and it will not receive credit. Note that you should also #include any other standard libraries your code relies upon (such as stdio.h). From this point forward, you will always have to have DupeyDupe.h in the same folder as your DupeyDupe.c file any time you want to compile your code. You should not send DupeyDupe.h when you submit your assignment, as we will use our own copy of DupeyDupe.h when compiling your code.

6. Function Requirements In the source file you submit, DupeyDupe.c, you must implement the following three functions. Super Important! These are the only three functions youre permitted to write for this assignment. You cannot write any auxiliary functions (helper functions). Please be sure the spelling, capitalization, and return types of your functions match these prototypes exactly.

int main(int argc, char **argv) Description: Process each command line argument (except for argv[0], which contains the name of the program being executed), and print the expected output to the screen as described above in Section 2 of this document (Overview). You should also consult the output files included with this assignment to see examples of the exact output formatting expected in this assignment. Note that the strings we pass to your program could be arbitrarily long. Note also that there are some special restrictions on how you can solve this problem (given on the following page). Return Value: Your main() function should always return zero. Related Test Cases: arguments01.txt through arguments08.txt double difficultyRating(void) Description: Return a double indicating how difficult you found this assignment on a scale of 1.0 (ridiculously easy) through 5.0 (insanely difficult). This function should not print anything to the screen. Related Test Case: UnitTest01.c double hoursSpent(void) Description: Return an estimate (greater than zero) of the number of hours you spent on this assignment. Your return value must be a realistic and reasonable estimate. Unreasonably large values will result in loss of credit. This function should not print anything to the screen. Related Test Case: UnitTest02.c 7. Special Restrictions (Super Important!) You must abide by the following restrictions in the DupeyDupe.c file you submit. Failure to abide by any one of these restrictions could result in a catastrophic loss of points. Please do not create any string variables or arrays in this assignment (other than the array of command line arguments itself). You should not create any new copies of the command line argument strings. Do not read or write to files (using, e.g., Cs fopen(), fprintf(), or fscanf() functions). Also, please do not use scanf() to read input from the keyboard. Do not declare new variables part way through a function. All variable declarations should occur at the top of a function, and all variables must be declared inside your functions or declared as function parameters. Do not use goto statements in your code. Do not make calls to Cs system() function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!