New answers tagged

1

Sometimes, the compiler can't quite figure out the real problem. But, at least it usually indicates roughly where it is! Look at the line of code: if (sum % 10 ! = 0) The problem lies with the operator " != ". In this code, there's a space between the exclamation point and the equals sign. You can't have a space there. That's what's breaking the ...


0

Just in case someone runs into a similar problem, I figured out the primary problem myself after running debug50. When typecasting pow(10,i) into an int, the program breaks down at 10 billion or pow(10,10) since, I presume, int can't hold that value. Typecasting instead with long pow(10,i) fixed the code and it runs correctly now. I guess it is important to ...


1

The structure is simple. Pay attention to placement of curly braces and semicolons, specifically, where they are NOT. #include statements // The next line is a function signature to tell the compiler that // the actual function will follow later. You either need a signature // or the actual function to appear before it is ever used anywhere. // note the ...


0

Still pretty new to the CS50 course myself, but I am having a hard time understanding this line of code here; mod1 = (credit % (int) round(pow (10, i)))/ pow (10, i - 1); Maybe the error might end up in there due to misplacement or omission of brackets? Another way is to create another variable that lets you break down the mathematical result of the ...


1

Strings are immutable. That means that when they are declared, the memory allocated to them cannot be changed. You can put a shorter string in that memory, but not a longer one because it will overwrite other memory allocated elsewhere. When plaintext is declared in the second code snipet, it has exactly one byte allocated to it, to hold the end of string ...


1

it seems that your "mario.c" is in the path: pset1/mario


Top 50 recent answers are included