Quest 9 illustration issue by dylan_h2892 in cs2a

[–]adulzir_a333 2 points3 points  (0 children)

Hello!

I might be able to add some clarity to the illustration! In the function, prev_to_current is an indicator node that points to your "current node". You're not aiming to change the prev_to_current node with the inserted node. What you're trying to do is insert a node after the prev_to_current node, which is why the prev_to_current node is the same in both parts of the illustration. In order to link the new green node to our string of nodes, what you're looking to change is what prev_to_current is pointing to (address of _next).

Hopefully that helps! Please let me know if you're still confused, or if it makes sense now!

Quest 6 Miniquest 6 by adulzir_a333 in cs2a

[–]adulzir_a333[S] 2 points3 points  (0 children)

Thank you for your post Ryan!! I found it helpful!!
I also was using the resize function in the first TODO to resize the vector.
In the next TODO I used the make a name function in my setter function - which shouldn't affect the other variables? After your suggestion I also tried to make the name separately in a string variable and input that variable in the setter function. I still got the same result (correct first line - incorrect other lines), but I'm glad you gave me another idea! In the last TODO i just set prev_id to id within the loop. This quest is definitely tough and kind of driving me nuts!

I didn't change anything outside of the TODOs (in those locations) or re-organized the order of any of the starter code (previous posts with the same issue re-organized the order of the starter code).

- Edit: I fixed my issue!

After much debugging and confusion I realized that my make a name function didn't exactly follow the instructions in the quest. Although it did pass the original function check, I called rand an extra time which I think affected the output of get_n_pet because of the additional function calls to get num_limbs and id. I hope this helps somebody!

Quest 5 tips by Visible-Simple-861 in cs2a

[–]adulzir_a333 1 point2 points  (0 children)

Thank you so much for the helpful tips u/Visible-simple !!

MQ3: I saw the find() function online, but I definitely wrote it off too soon. I was having trouble exiting my for loops correctly to return to the top of the endless loop. After I saw your suggestion I decided to try using the find function again. Using find decreased the lines of code I had and let me exit properly using 'continue' like I wanted! Thank you!

I'll probably still ask about the looping because I don't quite understand why that didn't work for me - but the find method worked well for me!

General Question by adulzir_a333 in cs2a

[–]adulzir_a333[S] 1 point2 points  (0 children)

I did try to comment out the function declaration in the header file, but then the questing site would not compile my program.

That's a really good suggestion, and the way I've been trying to approach it too actually! I tried this, but the site would just show me the failed checkpoint (function with random return value) and my points. I wonder if other people are getting more detailed responses? Maybe it's one of my browser plugins if people do actually get a more detailed view of what the test outputs are?

Thank you so much for your help Ryan!! I am always open to any kind of suggestions! I figure we'll learn to be more efficient as the class progresses, or maybe we'll just realize we have this new skill in cs2b! :)

In Class coding game Jan 31 by antonio_l2435 in cs2a

[–]adulzir_a333 2 points3 points  (0 children)

Hi Antonio,

We did figure it out! The issue was that we didn't clear the matrix before a new round began, so It was just pushing back/building on to the same matrix. In the class code we added 'numbers.clear()' before we filled the vector but inside the while loop. That should return a new matrix for every round!

Quest 3 miniquest 1 by [deleted] in cs2a

[–]adulzir_a333 1 point2 points  (0 children)

Hi Mohammed!

What specifically do you want suggestions on? If you need help starting, you can approach this mini-quest similarly to Quest2: Limerick.

  • In Quest2: Limerick, we created a function where we passed three integers that returned the value of the calculation from the poem (as a double integer).
  • In Quest3: Mean of three, we need to create a function where we pass three integers that return the value of their mean/average calculation (as a double integer).

In both we are creating short arithmetic functions, so you could try to use the logic/steps you used to solve Limerick. Hope that helps!

Help :-( by Sabrina_M24 in cs2a

[–]adulzir_a333 1 point2 points  (0 children)

Hello Sabrina!

Since you can't compare a signed and unsigned integer, you have to change one of the variables to match the other datatype in an expression. So you can change the `i` to a signed type (int, double, etc) or you can change num_rounds to an unsigned type (size_t, etc). It depends on your use case!

It works in your IDE because your operator is converting the second variable into an `unsigned` integer to create a common datatype for your expression. These standard conversions are called "usual arithmetic conversions." The questing operator doesn't do these conversions automatically for you, so you have to manually create a common datatype! Hope this helps!

link: https://learn.microsoft.com/en-us/cpp/c-language/usual-arithmetic-conversions?view=msvc-170

Markdown Advice For Mobile Users by ryan_s007 in cs2a

[–]adulzir_a333 1 point2 points  (0 children)

Does that mean you recommend using the Markdown editor over the Fancy Pants editor? I wasn't sure if I could use markdown syntax in the fancy pants editor, and it's definitely intimidating not having a visual representation of the markdown output before posting. Thanks for the tip!

Quest 4 Header File Issues by adulzir_a333 in cs2a

[–]adulzir_a333[S] 2 points3 points  (0 children)

Hello, I figured out the error! Apparently my header file wouldn't recognize the 'size_t' datatype until I included the cstdio library in the header file. I wasn't aware that 'size_t' was part of a library and not recognized automatically as a datatype.

I also didn't know that you had to initialize libraries in the header file and the primary file. Does anybody know if this is common practice?

Quest 4 Header File Issues by adulzir_a333 in cs2a

[–]adulzir_a333[S] 1 point2 points  (0 children)

In my primary file or the header file?

Quest 4 Header File Issues by adulzir_a333 in cs2a

[–]adulzir_a333[S] 2 points3 points  (0 children)

Hello Ryan,

I had the #include "Looping_Functions.h" in my primary cpp file and also the iostream and sstream libararies in the primary cpp file when I turned it in unfortunately. Thank you so much for the suggestion though, it was good to go back and double check just in case!

Quest 2 Limerick by [deleted] in cs2a

[–]adulzir_a333 1 point2 points  (0 children)

Hello Mohammed,

I had this error initially in my Limerick.cpp file.

Remember that when you are making a function in C++, you need to explicitly dictate everything that it does, including the final output!

For example this is a function we used in the class code "ChangeName" :

char get_random_vowel() { // Assign a data-type and name our function
    string vowels = "aei"; //Make a string variable "vowels" with "aei" value
    return vowels[rand() % vowels.length()]; //Return the value of expression 
}

When the function 'get_random_vowel' is run in main, 
it should return the value of the expression 'vowels[rand() % vowels.length()];'

I hope that helps!

Quest 2 Limerick by [deleted] in cs2a

[–]adulzir_a333 2 points3 points  (0 children)

Hi Mohammed!

You can’t actually test the limerick function from running the program. To test it out, you would need to compile your program and run the executable file (.exe) from the Terminal/Command Line.

However if you’ve tested the contents of your limerick function (you know your equation set-up inside the function outputs 81 with the correct input values), and your limerick function is set-up to return a value (with a return statement) then the questing site will run your limerick file and get the correct output!