# Caesar Cipher in C++

Come on people!!!!!

Caesar Cipher in C++

Closing this as of-topic is ridiculous. It compiles it runs it works (for specific input). Yes it has flaws but this code is basically 99.9999999% complete and for a beginner an already large investment of time.

We have a small community that most of us would like to see grow. But cutting of newbies like this is not going to help grow the community its just going to isolate it.

The OP is is clearly marked as "New contributor" you are supposed to be nice and a little more lenient towards these contributors and give them a helping hand. Reviewing this code would have been no effort because it actually works you don't need to fix anything for him and you can give him/her extra valuable information as part of the review that would help them become a beter contributed in the future.

## The requirements for review.

• Is code included directly in my question?

Yes

• Am I an author or maintainer of the code?

Personally I don't know. But it seems to be the OP code.

• Is it actual code from a project rather than pseudo-code or hypothetical code?

Again seems yes.

• To the best of my knowledge, does the code work as intended?

Does it work. Yes. Does it work perfectly. No. But we are allowed to submit code that does not work perfectly.

• Do I want the code to be good code?

It seems that way.

• Do I want feedback about any or all facets of the code?

He did not limit the review. So again yes.

So the only part where it "Seems" to fail according to your ultra strip interpretation.

To the best of my knowledge, does the code work as intended?

But even the OP says that his code works in some situations:

The program I have will work fine as long as there are no spaces in the message I enter.

So the code works perfectly if there are no spaces in the input.

But we have also stated many times that if corner cases don't work the code is perfectly acceptable. This is a corner case. As long as I exclude a small set of characters the code would continue to work (less than 10% of characters will cause an error).

## But the question would be perfect if we simply the question.

If the question was asked like this:

So I am pretty new to programming, trying to teach myself C++. I thought I would try to create a program based on the Caesar Cipher. The program I have workperfectly for single word encyptions. I would love if you could suggest ways to make this better. e.g. How would I go about encrypting a sentence? Been working on this for a little while now to try and figure it out myself, but have yet to make progress on encrypting or decrypting more than a single word. Here is my code:

Now its perfectly acceptable to the group.

The ludicrous nature that we so strictly interpret the rules here is why I think it is ridiculous to close it.

• It may be 99.999999% complete, but it's 0% usable according to the OP. – Peilonrayz Jun 10 '19 at 10:04
• @Peilonrayz That's an incorrect statement as I pointed out in the question. Is perfectaly usable for a limited set of input. – Martin York Jun 10 '19 at 16:19
• The OP even says: The program I have will work fine as long as there are no spaces in the message I enter. – Martin York Jun 10 '19 at 16:20
• I decided to round my hyperbole. But you could argue that mine isn't a hyperbole... – Peilonrayz Jun 10 '19 at 16:33
• All questions on Code Review should be requests for a review. Is a request for a feature still a request for a review? – Mast Jun 10 '19 at 16:45
• I would still VTC your example message. I have written a few answers explaining the short comings to this rule. Yes feigning ignorance can make a question on-topic. And there's no solution to that. But then the extra code they're requesting may not be added in an answer. – Peilonrayz Jun 10 '19 at 16:46
• @Mast If we answer with a review does it matter. The result is still something useful to future users of the site who could read the review and then benefit from the review. – Martin York Jun 10 '19 at 16:48
• That's a matter of policy. Current policy is that code has to work to the best of the author's knowledge. For the current policy, I understand why the current question got closed. Is your actual question to change this policy? – Mast Jun 10 '19 at 16:54
• @Peilonrayz: Sure I can. I can suggest many ways to make it better including a suggestion for handling more than one word at a time. – Martin York Jun 10 '19 at 16:55
• @Mast: My argument is the policy is two strictly interpreted. – Martin York Jun 10 '19 at 16:56
• @MartinYork You have misread my comment. – Peilonrayz Jun 10 '19 at 16:56
• @Peilonrayz OK. Then your comment is not clear. But also not relavant. – Martin York Jun 10 '19 at 16:58
• @MartinYork I don't see how you've misread it and so can't clarify. What exactly is you "Sure I can" in response to? Also I'm strictly talking about our policy, not the linked question. – Peilonrayz Jun 10 '19 at 17:00
• @Peilonrayz Now your just stating things that you want to be true. I can put whatever I want in an answer that would make the code better and in my opinion I could make the code function much better with a review on how the input output system works. From which a neutral explanation of how to read lines vs words evolves naturally. – Martin York Jun 10 '19 at 17:58
• Comments on this answer are getting flagged, and I agree these comments appear to be pushing the limits of healthy discussion. I have edited some, and this entire comment "thread" is at risk of being moved in to a chat room. – rolfl Jun 10 '19 at 21:45

I can see why the question has been closed. It clearly does not work as intended, the author states:

So essentially I can encrypt a single word, but not a sentence. The program crashes on me if I try to input more than one word. How would I go about encrypting a sentence?

If the code is intended to encrypt sentences, and it does not encrypt sentences, then it's clearly not working as intended. Your 99.99999% complete is my 75% complete.

While I agree that it would be nice to help people resolve their program issues, Code Review is not the right place for it. If restructured a little, that question would be a good fit for Stack Overflow.

Answering off-topic questions on Code Review causes confusion about scope, and sets precedence for other people to say 'Well, here's a question where they ask for help to fix their non-working code, why is my question closed for "not working as intended"?'

Being a new user does not give people special dispensation to ask off-topic questions.

Having said that, friendly comments with clues on how to re-ask their question on Stack Overflow, or hints on how to correct their code, would not be a problem.

• I would argue that a good review of the question would naturally evolve into a description of the IO system in C++ and thus fits nicely into solving the problem within the scope of a review. This answer would not only benefit the OP but would also benefit future users of the site trying to get information about the IO system in general. – Martin York Jun 10 '19 at 18:01

As I see it, being nice to new contributors means that we give them more friendly guidance on how to make their questions and answers acceptable for Code Review. It doesn't mean that we lower our quality standards or ignore our rules.

I believe that the question is off-topic, as originally posted, because it asks for help to fix the code to accommodate multiple words in the input. Our standard is not whether the code compiles or runs for some inputs. The code does not work as intended, and the question is therefore off-topic.

One obvious way to bring the question on-topic is for the original author to fix the bug. Another approach would be to edit out the request to handle multiple words — but in my opinion that would change the character of the question too much and violate the author's intent.

I think that making an exception to allow broken code would be detrimental to the Code Review community in the long term. We would then be getting into debates about how minor of a bug is allowable, or dealing with a flood of bug-fixing requests.

What is truly unfortunate about this specific question, though, is the fact that it got downvoted to -5. Downvoting to -1 would have been sufficient to point out that the question needs fixing. I personally only downvote to -3 to indicate true displeasure ("Your question is irredeemable; please don't bother wasting our time"). But -5 is saying "You asked a bad question and you should feel bad", which should not have been the case here.

I think that whoever cast the final downvotes should have been more considerate and shown more restraint.

• There's a very important difference between being a bad question and being an off-topic question. This question might be off-topic, but it's certainly not bad. I don't think all off-topic questions deserves a downvote. – Simon Forsberg Jun 10 '19 at 11:50
• Because he asked for help in improving it is off topic! I would argue that no code ever written works perfectly as intended. All code can be improved, but more importantly It can have benefit to other users. As long as a review of the code could provide benefit to others that ultra strict interpretation of "It works as intended" is counter productive. – Martin York Jun 10 '19 at 17:07
• What defines a corner case? IS 10% a small enough set of input to define a corner case. White space is less than 10% of the character set. – Martin York Jun 10 '19 at 18:02
• Who said anything about a "corner case"? The author explicitly asks for help to fix the code's inability to meet expected behavior. The code just doesn't work as the author intended. That makes the question off-topic. – 200_success Jun 10 '19 at 18:04
• Who said anything about a "corner case"? I did. Less than 10% of input causes a problem so its a corner case. So should we not a least consider it under that exception. – Martin York Jun 10 '19 at 22:42