- Joined
- 5 Dec 2001
- Messages
- 6,498
So far we have been outputting to the shell, hello world and the osnn.net lines. However, there has to be a way that we can specify what we want it to do by checking the argument we get sent when we start the program.
Task 2-1: Create a program that prints all the arguments passed to it
Task 2-2: Modify the above program to sort them alphabetically first
Task 2-3: Find all duplicate arguments and remove them
Task 2-4: Using your knowledge about arguments. Create a program that depending on what the argument passed is will ask for either of the following:
Arg 1: Your name and birthday, and outputs how old they are in days.
Arg 2: Random line of text, to be printed on new lines
Arg 3: Print hello world.
So "program 2" would ask me for a random line of text and print it out on new lines.
If no argument is passed it should print the list of options as well as the name of the current program, and how it should be used.
Good luck. I will post my solution to Day 1 tomorrow.
Task 2-1: Create a program that prints all the arguments passed to it
Task 2-2: Modify the above program to sort them alphabetically first
Task 2-3: Find all duplicate arguments and remove them
Task 2-4: Using your knowledge about arguments. Create a program that depending on what the argument passed is will ask for either of the following:
Arg 1: Your name and birthday, and outputs how old they are in days.
Arg 2: Random line of text, to be printed on new lines
Arg 3: Print hello world.
So "program 2" would ask me for a random line of text and print it out on new lines.
If no argument is passed it should print the list of options as well as the name of the current program, and how it should be used.
Good luck. I will post my solution to Day 1 tomorrow.