Hot answers tagged

3

I added a space in there and it took the flag away. The rest of the print lines without the space are not flag. I'm wondering if this is a bug with the IDE or am I not understanding something? This fixed the first line: print("s: ", end="" ) UPDATE: I've logged back in this morning to find the invalid syntax flag is back even on my updated code. At ...


2

http://docs.cs50.net/problems/hello/hello.html#code-check50-code clearly states that the command for calling check50 for hello is check50 2016.hello hello.c (assuming you're in the same directory as hello.c)


2

Duh! Read right through it and missed the problem myself. Should have seen it earlier. The problem is that the code reads from the input file to populate the two headers for the input file, and then reads again to populate the output file headers. (I won't even mention that they were read in the wrong order.) BUT, since it doesn't reset to the beginning ...


2

There is a significant flaw in the code. The header vars are changed (probably correctly) but then stored in the original headers for the input file, bi, bf. Then the output file headers are written out to the output files, bih and bfh. This has led to input and output header fields being intermixed in both being written out to files and used in the code. ...


1

A quick glance at the code and I found a significant problem, there may be more. When the code finds a signature, it goes through the process of closing the old file, opening the new file, and writing the block out to the file. THEN, it checks to see if a file is open and, if so, writes the block out to the open file. In other words, it's writing the ...


1

An invalid slug error means that the parameter following check50 or submit50 is incorrect. Go back to the problem spec and see what it's supposed to look like. I'll guess a missing slash or something. If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)


1

Be sure to run update50 first, and then close and re-open any terminal windows! There's been a new release of check50 which will allow you to check with the syntax shown in the problem set specification.


1

Check this simple program, and see what happens when you get a float from the user using get_float() and then cast it to str. See what is wrong with it and how your program fails? import cs50 def main(): x = cs50.get_float("Number: ") print(str(x)) if __name__ == "__main__": main() Output: Number: 20 20.0 Also, your program is full of "...


1

It is explained in the Check50 section of the spec.


1

It can be challenging specially that you're still in the first few weeks. There are many I/O functions in the C standard library that you can use for that purpose. One of them is fgetc. Execute man fgetc in the terminal for more info on that function! The approach could be as follows: // read number 1. declare a string called num // make sure it's big ...


1

You have a bit of work to do. Just try to push you in the right direction. You have variables declared outside of the main function (ni, f) , unless it is unavoidable you want to give variables local scope (declare them within a function). Currency is an array of ints, so the line ni - currency if we were to substitute the variables for actual values would ...


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