Classwork 15: Command Line Arguments
Thursday, August 10, 2012[Previous Classwork] [Next Classwork]
Complete the following:
- Create a file named cw15.c
- Write a program that must take in 3 command line arguments.
- You must prompt the user with the correct number of arguments when an incorrect number is entered.
- Based on the first command line argument complete the following:
- Add — Adds the next two command line arguments and prints the result
- Sub — Subtracts the next two command line arguments and prints the result
- Eq — Tests the next two command line arguments for equality and prints the result.
- Cat — Concatenates the next two command line arguments and prints the result.
- Here is a sample run based on the following:
linux3[25]% ./cw15 Add 5 10
Adding 5 + 10 = 15 Thank you for running our program.
linux3[26]% ./cw15 Cat Big Foot
Concatenating Cat & Foot - BigFoot Thank you for running our program. - Once you are done, use submit
linux3[26]% submit cs104 cw15 cw15.c typescript
- After submitting your files, you can verify your files were submitted by using the submitls command
- MAKE SURE YOU LOGOUT AFTER SUBMITTING THE ASSIGNMENT AND BEFORE LEAVING CLASS!