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="" )
I've logged back in this morning to find the invalid syntax flag is back even on my updated code. At ...
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)
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 ...
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. ...
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 ...
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. ;-)
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.
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?
x = cs50.get_float("Number: ")
if __name__ == "__main__":
Also, your program is full of "...
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 ...
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 ...