cs50

CS50 Caesar program is working but check50 says it isn't

蓝咒 提交于 2021-01-28 00:28:44
问题 I created this program but I'm getting errors on CS50 showing that I didn't do any of it correctly. The requirements are as follows: Implement your program in a file called caesar.c in a directory called caesar. Your program must accept a single command-line argument, a non-negative integer. Let’s call it k for the sake of discussion. If your program is executed without any command-line arguments or with more than one command-line argument, your program should print an error message of your

CS50 recover segmentation fault Oct 2020

偶尔善良 提交于 2021-01-27 19:13:00
问题 I'm new to coding and started with Harvard's CS50 course. I've written some code for recover for cs50, and tried to run it, but segmentation fault occurs. In need of some help in identifying what's wrong. #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./recover image\n"); return 1; } FILE *file = fopen(argv[1], "r"); if (file == NULL) { printf("Usage: ./recover image\n"); } char filename[8];

cs50 tideman lock_paiors function issue

馋奶兔 提交于 2021-01-20 09:20:30
问题 hi guys im having problome with my lockpairs functinog on pset3 tideman would love some feedback ty bool checkcycle(int from, int to) { if(from == to) { return true; } int i; for (i = 0; i < candidate_count; i++) { if(locked[from][i]) { checkcycle(i,to); } } return false; } void lock_pairs(void) { for (int i = 0; i < candidate_count; i++) { if(!checkcycle(pairs[i].winner , pairs[i].loser)) { locked[pairs[i].winner][pairs[i].loser] = true; } return; } } :( lock_pairs locks all pairs when no

CS50 tideman - :( lock_pairs skips final pair if it creates cycle

╄→尐↘猪︶ㄣ 提交于 2021-01-05 06:08:48
问题 I'm new to stackoverflow and pretty new to programming. I'm working on the tideman problem for the CS50 course. https://cs50.harvard.edu/x/2020/psets/3/tideman/ When I run check50 everything checks out except for one: :( lock_pairs skips final pair if it creates cycle lock_pairs did not correctly lock all non-cyclical pairs These two do pass the test: :) lock_pairs locks all pairs when no cycles :) lock_pairs skips middle pair if it creates a cycle I can't find the problem. What am I missing

PSET 3 Tideman CS50 lock_pairs doesn't lock correctly

喜你入骨 提交于 2020-12-26 05:06:06
问题 i am new to this site so i might not ask my question correctly which i am sorry for but i have been struggling with PSET 3 Tideman for quite a while. Currently i am on lock_pairs and i dont know what to do. Would appreciate your help! These are my prompts for check50: :) lock_pairs locks all pairs when no cycles :( lock_pairs skips final pair if it creates cycle lock_pairs did not correctly lock all non-cyclical pairs :( lock_pairs skips middle pair if it creates a cycle lock_pairs did not

PSET 3 Tideman CS50 lock_pairs doesn't lock correctly

泪湿孤枕 提交于 2020-12-26 05:05:49
问题 i am new to this site so i might not ask my question correctly which i am sorry for but i have been struggling with PSET 3 Tideman for quite a while. Currently i am on lock_pairs and i dont know what to do. Would appreciate your help! These are my prompts for check50: :) lock_pairs locks all pairs when no cycles :( lock_pairs skips final pair if it creates cycle lock_pairs did not correctly lock all non-cyclical pairs :( lock_pairs skips middle pair if it creates a cycle lock_pairs did not