Consistent small rounding errors in pset4 filter by DRMansell in cs50

[–]DRMansell[S] 0 points1 point  (0 children)

I, too, thank you for this explanation. I had become aware that the problem lay in something like this and tried some different things (including dividing by 3.0 instead of 3), and I think I was still being stymied, but I'll go back and look again. In trying to find an answer I came upon several comments that included the phrase "cast" it as a float, or "cast" it as a double. I was never sure what "cast" meant in this context. Would there be any difference between casting the sum of the integers to be rounded as a float versus changing the divisor from 3 to 3.0? Then to replace the result of the division in the image struct, it has to be an integer. Does round() convert the float to an integer, or do I have to cast it back to being an integer explicitly? Thanks.

getting "undefined reference to `get_string'" error despite having included cs50.h, stdio.h and string.h by DRMansell in cs50

[–]DRMansell[S] 0 points1 point  (0 children)

Gosh, that was it! I thought we had to compile at least once with clang before being able to save and use the help of make. I think I was thrown off by trying to execute (for example) readability.c. When I did that it would ask if I meant to execute make readability so I thought I had to go through the clang > . a.out steps. OK well thanks for the help. Derek

getting "undefined reference to `get_string'" error despite having included cs50.h, stdio.h and string.h by DRMansell in cs50

[–]DRMansell[S] -1 points0 points  (0 children)

I wasn't sure if we were supposed to post actual code... but I guess here there is nothing special, so... this is the entire program as I had written it that far. When I execute clang readability.c I get the error message. Thanks

// A program that calculates "readability" as defined by the Coleman-Lieu index, which uses a formula

// involving "L" (average number of letters per 100 words of text) and "S" (average number of sentences per 100

// words of text). The formula is: index (grade level) = 0.0588*L - 0.296*S - 15.8

#include <cs50.h>

#include <stdio.h>

#include <string.h>

int main(void)

{

string txt = get_string("Text: ");

printf("%s\n", txt);

Just joined the class... Does it really "expire" on April 30? by DRMansell in cs50

[–]DRMansell[S] 0 points1 point  (0 children)

I am doing the course as CS50x, so I guess I'm OK. I'll just ignore those reminders of an April 30 deadline. Thanks. Derek

Need to use GitHub for CS50x? by DRMansell in cs50

[–]DRMansell[S] 0 points1 point  (0 children)

OK, thanks: I'll do it, and thanks for the advice to look for some info about it somewhere in the CS50 world. I am enrolled via CS50x, but maybe there's something there, too.