![]() |
|
#1
|
||||
|
||||
Re: Command Line Arguments, Part 2I just posted a GID Community blog entitled: Command Line Arguments, Part 2.
Quote:
Please let me know what you think. This is an auto-generated message posted by GIDNetwork™ on behalf of the author. __________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
||||
|
#2
|
|||
|
|||
Re: Command Line Arguments, Part 2Quote:
The topic basis is a good one, but there are probably enough convincing arguments to suggest that for every switch statement, that there should also be a default case, which seems to be missing in your code examples. Just a thought that you might like to add a default case. In the example of command line argument processing, it is entirely likely that someone could easily enter something that wasn't handled by your case statements and therefore would be handled properly with a default case... :davis: |
|
#3
|
||||
|
||||
Re: Command Line Arguments, Part 2Quote:
Without the default case in the first example, a single invalid letter would be ignored as would any second or further letter in the parameter. Not a big problem in this example, but worth pointing out for a more critical project. In the second example, an illegal character was silently ignored and could bunge up the calculation. A definite error. Thanks for pointing that out. __________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
|
#4
|
||||
|
||||
Re: Command Line Arguments, Part 2That was a nice little tutorial. One thing that you might want to challenge the reader to do at the end (with the calculator example). Is to alter the code to handle preorder and postorder operations such as '2 3 +' or '/ 8 2' instead of assuming that the first num passed with always be the first operand.
__________________
If practice makes perfect and nobody's perfect... why practice? Homepage: http://www.treywhite.com Blog: http://www.treywhite.com/blog.php Web Design Company: http://www.ewebproductions.com |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Beginning Python Tutorial (Part 3) | crystalattice | Python Forum | 0 | 16-Aug-2005 03:51 |
| [Tutorial] Pointers in C (Part II) | Stack Overflow | C Programming Language | 0 | 27-Apr-2005 18:36 |
| help with arguments to main | krepunk | C++ Forum | 1 | 16-Mar-2005 13:44 |
| main() arguments | crystalattice | C Programming Language | 2 | 24-Oct-2004 01:05 |
| Re: Command Line Arguments, Part 1 | WaltP | C Programming Language | 0 | 11-Jul-2004 00:34 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The