Timeline for PSET 2 Caesar : help debugging caesar : continued #2
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 27 at 18:51 | comment | added | UpAndAdam | sure post it and I will take a look at the new code | |
Jan 27 at 1:14 | comment | added | AmyG | Absolutely, thank you very much for your patience and help!! I'm still having issues with the ciphertext not getting printed out but I'm thinking it might make more sense to just post the new code in a new question to see if you or anyone can help me spot the problem. It's probably something small and obvious but I'm new to this and can't quite figure it out! Thanks again. | |
Jan 27 at 1:08 | vote | accept | AmyG | ||
Jan 26 at 17:11 | history | edited | UpAndAdam | CC BY-SA 4.0 |
updated info on null term and corrected some variable names
|
Jan 26 at 17:08 | comment | added | UpAndAdam |
@AmyG I'll add null terminator instructions to my answer.. for your other question thats perplexing... it should work... however I wouldn't alter plaintext at all just assign the result of the rotation to ciphertext. ciphertext[i] = rotate(plaintext[i], key); that's it. Otherwise what did you need a seperate string ciphertext for if you are going to modify plaintext ? For null terminator: ciphertext[text_length] = 0; or ciphertext[text_length] = '\0'; Again PLEASE UPVOTE answer if it is helpful and accept it if it answers your question. That's all we ask in return for helping.
|
|
Jan 26 at 2:00 | comment | added | AmyG | One more thing - I understand what the null terminator is but I'm not sure what exactly it means to "set" it. This was covered only briefly in the lecture and section videos and looking through my notes, I don't see a way to declare it somehow, other than to make sure the array has an extra character at the end to leave space for it. Can you let me know what other steps I need to take? | |
Jan 25 at 20:25 | comment | added | AmyG |
ok, I realize I was making it more complicated than I needed to!! I fixed only_digits and most of the other issues you mentioned in your comments but I'm still getting stuck on how to carry the info from the rotate function back to ciphertext . I added a line of code plaintext[i] = rotate(plaintext[i], key); between rotate(plaintext[i], key); and ciphertext[i] = plaintext[i]; to try and fix this but it's still not working. Any further advice you can offer me here?
|
|
Jan 25 at 17:33 | comment | added | UpAndAdam |
nothing.. the loop will autmatically go on just like in your other for loops in main. at the end of the body of the loop it will perform the provided increment instruction, check the condition and loop again. your condition for the loop is correct you just have remove the incorrect early return true that you do inside the loop body and put it outside the loop to be done when the loop completes and didnt return early for a false case... if my anwer is useful please upvote it and consider accepting it if it solves your problem
|
|
Jan 25 at 13:29 | comment | added | AmyG |
Thank you so much for your thoughtful and lengthy response!! I'm really stuck with the only_digits function. I understand logically the problem (I think), but I don't know how to tell the loop to go again until it reaches the end of the string. In other words, after if (isdigit(s[i])) , I don't know what to put inside the following curly braces in order to continue the loop. I tried creating a variable, first as an int, then as a string, to "store" the value of s[i] for as long as the loop continues but that didn't work. I tried using a different kind of loop (do, while) but still stuck..
|
|
Jan 24 at 15:31 | history | edited | UpAndAdam | CC BY-SA 4.0 |
added 374 characters in body
|
Jan 24 at 15:19 | history | answered | UpAndAdam | CC BY-SA 4.0 |