View Single Post
Old April 25th, 2016, 02:49 PM
Rod Stephens's Avatar
Rod Stephens Rod Stephens is offline
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

Then statement in the beginning, I can assure you that it does reject all the Qs, %s, lower case letters, Arabic numbers, decimal points, etc., because I have tested that. It's just that the meat of the program is not written properly .
Sorry, I mean you could fool it if the input contains one of the allowed letters in addition to prohibited letters. For example, try IQ. The I makes it pass the If test and then the Q doesn't make sense.

> "You may not post attachments."

Huh. I don't know why that's the case. Maybe if you click Advanced Options? (And actually I should have been less lazy. It's just one method so I could have copied and pasted it into a new program easily enough.)

I think VS 2015 creates the .vs directory, but it may be hidden in Windows Explorer (or File Explorer as they're calling it these days). But the issue is moot if you can't post an attachment.

Another tip: Most programmers try hard to avoid using GoTo because it makes the code harder to understand.

I've attached an example that seems to work if the input is well-formed. For example, it doesn't complain about values like XIVI, XVVV, and IXIV, which should not be allowed. You can try to figure out how to catch cases like those.

Give it a try and let me know if you get stuck. (I actually haven't thought it through yet. For this sort of thing, it's important to be sure you understand what should happen and why before you start writing code, and I haven't done that.)
Attached Files
File Type: zip (11.8 KB, 5 views)

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
The Following User Says Thank You to Rod Stephens For This Useful Post:
Maximilian (April 25th, 2016)