Hot answers tagged

2 votes

2019 CS50 PSet 4 Filter Less

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 ...
  • 63
2 votes
Accepted

Week 6: DNA sequence aligning example: Are running times iterative approach and reqursive same?

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 ...
  • 20.7k
2 votes
Accepted

I finally got my code to work but now I can't submit it can anyone tell why?

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.)
  • 64.7k
1 vote
Accepted

What is the purpose of & in c++?

& 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 ...
  • 940
1 vote

What is the purpose of subtracting 1 while inside a increment?

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 ...
  • 64.7k
1 vote

Need help debugging

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++
  • 64.7k
1 vote
Accepted

Lecture Week 6: Dynamic programming: rod example, is the recursion approach correct?

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 ...
  • 20.7k
1 vote
Accepted

Pset 2 Vigenere: I know the problem but can't figure it out

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 ...
1 vote

Conversion of hexadecimal to floating point

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 ...
  • 3,336
1 vote

Writing solutions in C++ instead of C

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

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