Hot answers tagged

2

Try using the flag -std=c11 on your compilation line.


2

Have you watched the "Walkthrough" videos yet? It looks like there's only one video, but there are actually several (just kind of hidden because they will play one after another, and you can select which one with a playlist to the top right corner of the video screen). Watching the video on the grayscale implementation helped a lot, and I was actually able ...


2

Recursive with memoization and non-recursive do the same number of computations. The recursive version however is more complex, memoization requires some check whether the value already has been calculated (the loops guarantee that), the additional function calls add some overhead, memory and time wise. The most important thing in recursion is a) defining ...


2

Perhaps if you renamed your file from cEAsar to cAEsar, it might work. (note that the upper case letters are to draw your attention to the misspelled name. make it all lower case.)


1

& is the reference operator, which returns the actual address in memory of a value. Here, the function declaration is asking to be passed the addresses in memory of an int and a float, rather than the values of an int and a float. The main difference in practice is that this allows the function to modify the original variables passed to it. It is similar ...


1

This question is nearly impossible to answer without context. It all depends on what number represents and how it's being used. Having said that, one thing comes to mind. Say that number is being used to count through a list of some kind and the numbers run from 1 to 5. Now, you have this array, called counts. Arrays are numbered starting at 0, not 1. So, ...


1

Maybe try <vector.h> and <string.h>? Note the missing .h BTW, how is this related to CS50? I don't believe it's teaching c++


1

Recursion isn't done right. For example, your function meant to return an int might end without returning anything. Essence of recursion is that you define a base case (like for example rod of length 0 is worth nothing), and assume a sub-problem closer to that base case (shorter rod) can already be solved. Like you get a rod of length 10, and assume the ...


1

I think the line string key = word; is not doing what you think it is doing. Define the stringkey and then use strcpy to copy the contents of word into key. The way you are doing it, you are defining key to point to the same address as word so changing key[0] is the same thing as changing the value at word[0].


1

In C and C++, the direct conversion goes as follows int i = 0xFF2; float f = 0xFF2.25p10; cout<<"i = "<<i<<endl<<"f = "<<f; Gives output as i = 4082 f = 4.18012e+06 However, this does not highlight the logic behind the conversion, the same can be carried out on pen and paper as follows: Write the whole hexadecimal string ...


1

No, you have to use C in order for your code to be compiled and graded.


Only top voted, non community-wiki answers of a minimum length are eligible