cs50

CS50 - Issue with pset4 filter “blur”

独自空忆成欢 提交于 2020-07-23 08:47:40
问题 My blur function is behaving oddly. I've recreated the 3x3 bitmap from check50 to get more approximate results from my tests but, for some reason, every right or lower edge pixels are not working properly. While debugging, I've found that, for some reason, my for loops are not behaving properly. I'll show my code and an example below. Code: // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE temp[height][width]; // Declares temporary structure to avoid

CS50 - Issue with pset4 filter “blur”

血红的双手。 提交于 2020-07-23 08:46:07
问题 My blur function is behaving oddly. I've recreated the 3x3 bitmap from check50 to get more approximate results from my tests but, for some reason, every right or lower edge pixels are not working properly. While debugging, I've found that, for some reason, my for loops are not behaving properly. I'll show my code and an example below. Code: // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE temp[height][width]; // Declares temporary structure to avoid

CS50 DNA works for small.csv but not for large

纵然是瞬间 提交于 2020-07-10 03:16:28
问题 I am having problems with CS50 pset6 DNA. It is getting all the right values and gives correct answers when I use the small.csv file but not when I use the large one. I have been going through it with debug50 for over a week and can't figure out the problem. I assume the problem is somewhere in the loop through the samples to find the STRS but I just don't see what it is doing wrong when walking through it. If you are unfamiliar with CS50 DNA problemset, the code is supposed to look through a

How to catch the longest sequence of a group

情到浓时终转凉″ 提交于 2020-07-05 12:34:20
问题 The task is to find the longest sequence of a group for instance, given DNA sequence: "AGATCAGATCTTTTTTCTAATGTCTAGGATATATCAGATCAGATCAGATCAGATCAGATC" and it has 7 occurrences of AGATC. (AGATC) matches all occurrences. Is it possible to write a regular expression that catches only the longest sequence, i.e. AGATCAGATCAGATCAGATCAGATC in the given text? If this is not possible only with regex, how can I iterate through each sequence (i.e. 1st sequence is AGATCAGATC , 2nd -

importing C library in windows

℡╲_俬逩灬. 提交于 2020-07-05 05:09:03
问题 Really basic program in C, but I'm getting the following error: tcc: error: undefined symbol 'GetFloat' What's the problem and how do I fix it? I placed cs50.c and cs50.h into the same directory as my script. The following is my main file: #include "cs50.h" #include <stdio.h> int main(void) { printf("enter change owed: "); float x = GetFloat(); printf("you entered %f\n", x); } Here's cs50.h /**************************************************************************** * CS50 Library 4 * https:

importing C library in windows

試著忘記壹切 提交于 2020-07-05 05:06:22
问题 Really basic program in C, but I'm getting the following error: tcc: error: undefined symbol 'GetFloat' What's the problem and how do I fix it? I placed cs50.c and cs50.h into the same directory as my script. The following is my main file: #include "cs50.h" #include <stdio.h> int main(void) { printf("enter change owed: "); float x = GetFloat(); printf("you entered %f\n", x); } Here's cs50.h /**************************************************************************** * CS50 Library 4 * https:

CS50 Caesar program (pset2) runs but outputs errors in check50 (“expected exit code 1, not 0”)

家住魔仙堡 提交于 2020-06-29 03:47:52
问题 I finished pset2 (caesar) of CS50, but when I run it through check50, I get three errors, each involving the command-line arguments in some way. When I try to test it myself, it works fine, which makes me think the problem is "under the hood" and not able to be solved unless I revise my code. I tried deleting uncessary lines, but the errors still persisted, so I was wondering if someone could take a look at my code and tell me what's wrong. Here's the code: #include <stdio.h> #include <stdlib

CS50 blur function does not pass check50, even though image is being blurred

故事扮演 提交于 2020-06-28 03:40:55
问题 I am working on a CS50 problem set in which I need to do a box blur for each pixel of an image. Though my code is a bit redundant, as I had created 8 if statements for special cases of pixels (like edges and corners), it blurs the image as expected, so I'm not really sure how to fix the problem. Here's the error code: :( blur correctly filters middle pixel expected "127 140 149\n", not "145 160 169\n" :( blur correctly filters pixel on edge expected "80 95 105\n", not "90 106 116\n" :) blur