- This topic has 0 replies, 1 voice, and was last updated 3 years, 9 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
aiannum.com has rebranded as Progaiz.com
› Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 2: [Arrays] – Functions, Variable and Scope, Debugging, Arrays, and Command Line Arguments › Assigning keys to plaintext with ASCII
[dm_code_snippet background=”yes” background-mobile=”no” slim=”yes” line-numbers=”yes” bg-color=”#abb8c3″ theme=”dark” language=”clike” wrapped=”yes” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]
for (int i = 0; i < countstring; i++) //starts with first character of plaintext till the end
{
for (int c = 0; c < 25; c++)
{
if (s[i] == argv[1][c])
{
s[i] == int argv[1][65 + c];
}
}
}
printf("ciphertext: %s", s);
[/dm_code_snippet]
Seeking help what is wrong with s[i] == int argv[1][65 + c];
Reply
assignment operation = is different than equality condition ==
Query
s[i] == int argv[1][65 + c];
Do you mean, it should be:
s[i] = int argv[1][65 + c];
instead of:
s[i] == int argv[1][65 + c];
Reply
aren’t you trying to “assign” the value of argv[][] to s[]?
Query
Yes.
Reply
then use assignment operator[learn_press_profile]
