![]() Personally, I'd prefer to call index1 and index2, destination and source (abbreviated if you like) to show their role. Then jumble= blog store means to replace the char at position index2 with C, so AAT becomes ACT. But the important point is that it applies to the values of the variables at that instant only. Set equal means to set or make equal, not "define as equal for all time"! I prefer the old-fashioned term, "is assigned the (current) value of". You had it right with "jumble", which means, the character in position index1 of the string is called "jumble". Time is just to "seed" the random number generator at the start of the program so that you don't get the same pseudorandom numbers every time you run it This may not appear as I intended - I can't find a Preview button? But I've saved and edited it a few times and it's starting to look ok! Personally I'd prefer to call index1 and index2, destination and source (abbreviated if you like) to show their role. Then ACC becomes ATC (jumble=store means "ACC"="T" ) Store becomes T (store=jumble = ACT =TĪCT becomes ACC (jumble=jumble means "ACT"="ACT" ) If you run through a second loop with index1=3 and index2=2 then Then jumble=store means replace the char at position index2 with C, so AAT becomes ACT. Replace the character at position index1 with the character currently at position index2. Given jumble = CAT, index1=1, index2=2, so store = C then: Set equal means set or make equal, not "define as equal for all time"! I prefer the oldfashioned term, "is assigned the (current) value of". You had it right with "jumble", which means, the character in position index1 of the string called "jumble". From my understanding it appears that jumble is being set equal to jumbleindex 2 which is clear but then jumbleindex2 is being redefined as what was set for the char value for the 1st index. The problem is with the last two lines of code. ![]() I know, I'm probably too stupid to be a programmer haha Anlyzing the code that I posted should give you an idea(hopefully) as to the question I am asking and all on all why the section of the code works the way it does. So to me actually CCT would be displayed to the console. ![]() ![]() To me it seems that when a is set = b it will then see that b = storeindex which = C. So now when we run the console program again we get Now let's say we want to scarmble the words C and A Let see we want to print the word cat to the console, this is pretty straight forward. Let me be specific with my question by using pseudocode From my understading it appeats that jumble is being sext equal to jumbleindex 2 which is clear but then jumbleindex2 is being redefined as what was set for the char value for the 1st index. I understand the core parts like how each index is being defined as a random value based on time and all that. While ((guess != theWord)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |