❔ Help me out please
Im trying tho encrypt words and im pretty much stuck in here. Im very weak at coding so please forgive me in advance
18 Replies
im trying to like change the letter inside the array
What kind of cypher do you want to use?
like uh
a + 2 = c
for example
foreach is read-only
oh so its usless?
Useful if you don't need to change the values
And just do something with each value that doesn't involve putting something else in the source collection
can you explain it rq
foreach relies in IEnumerable which is the backbone of all collection types, including read-only types
All foreach knows is it received a character from this unknown collection, then another character and another
oh ok
So use for if you need to replace
Then you can use the index
array[i] = newValue;
ok
how do i make this work
im trying to like replace the letter of the array alf with a letter of the array lett
with the help of the key (ch)
so again if theres the letter a the array will move ch places and replace it
i tried to add the key to the var a but no matter how i convert it, it will always give me an error
wait nvm i fixed it for now
good job me
Unless I'm missing something, this seems unnecessarily complicated. Can't you just use a dictionary?
thats the issue i think i gotta do it without those
and also ive never used them anyways
This is known as a Caesar Shift. I did find some interesting tutorials online. No dictionaries necessary, you can do it with some math and some casting.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.