• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Program Help

 
Adam Stever
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am posting a program that needs some obvious attention, My goal here is to prompt the user wether they would like to encrypt or decrypt their file and obviously just incement by 1, Please help.

 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please TellTheDetails. What are the errors you are facing?

One obvious error is you have declared fileName as a String variable, but you try to use it as an array.
 
Michael Krimgen
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am not sure what exactly your program is supposed to do, so it would be good to have an explanation.

However, the following part of your code looks rather odd to me:



I have some doubts that it does what you intend it should do.

1) You have semicolons after the if and else, which in fact represent an empty statement. The following blocks in curly brackets will always be executed.
2) if (fileName [i] = ch) is an assignment, not a condition

 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done picking up the extra semicolons. I think that block won’t even complete since the else is separated from its if by the semicolons.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread looks to me like a duplicate of the last question here, so I shall close it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic