Questions tagged [code]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

I have a problem regarding “ Condition”

Well, I am learning the C program. When I wrote a command I got an error message but I don't know why. The code runs like this:- if (answer == "something") [here, the 'answer' is a string ...
0
votes
1answer
15 views

Trying to do pset 2, but it doesn't even accept my input. What am I doing wrong?

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> #include <math.h> int check(int c, string key); int main(int argc, string argv[]) { int ...
0
votes
2answers
36 views

how do i write pesudocode.txt for Mario? (less comfortable)

After I input: mkdir ~/pset1/mario its asking me to write pseudocode.txt and i am not sure how i can do that. I've tried inputting the pseudocode.txt and that gives me "command not found"
0
votes
1answer
14 views

Syntax Highlighting Error

I am working on my mario problem. I write my code in C, but it's not getting highlighted, meaning the program doesn't understand it. How can I get it to understand my code? for example #include is in ...
0
votes
1answer
70 views

Pset7 Movies Q12: I don't get what's wrong

I can't figure out why my pset7 movies Q12 code isn't working. Can anyone tell me why? Here is my code: SELECT DISTINCT title FROM movies, stars, people WHERE movie_id IN (SELECT movie_id FROM stars ...
0
votes
1answer
35 views

Error: use of undeclared identifier 'j'

My code looks fine but "make mario" insists that "Error: use of undeclared identifier 'j'". #include <cs50.h> #include <stdio.h> int main(void) { int n; do { n = get_int ("Height: "...
0
votes
0answers
128 views

Pset5 : Speller

I'm wondering how I can solve pset5: Speller. I've been stuck on speller for about a week now. I've been looking for help, but they seem to be all using tries, and i'm using a hash table. Should I ...
0
votes
1answer
44 views

Mario Less Loops doubt and code review

I have attempted the PSET 1 of 2020 CS50x and have a couple of doubts. Could someone check if the following code for Mario less one is correct. If it is I also had a question that what should I put ...
0
votes
1answer
13 views

Why is the value 16,432 appearing, and why is it getting reduced each time I run the program?

So I was following along the week one lecture, and I was trying to replicate the average-taking program, when I made a slightly silly mistake- I used the average function within the for loop. #...
0
votes
1answer
231 views

Greedy(less comfortable) questions/thoughts/input/advice on my programm

Hello I am relatively new to programming and C in general. I have left the comments next to the points I have questions to, please don't give me any solutions, as I really want to learn and ...
0
votes
2answers
109 views

Help! CS50 Error message not making sense at all

I am in week 1 on CS50 2017, and in the lecture he presents a code written as follows: #include <cs50.h> #include <stdio.h> int main(void); { int n = 0; while (true) { ...
0
votes
1answer
39 views

pset6 - greedy doesn't print answer- just returns the input. Where have I gone wrong?

import cs50 while True: print ("O! Hail!, How Much Change Is Owed?") n = cs50.get_float() if n >= 0: break q = 25 q1 = 0 d = 10 d1= 0 ni = 5 ni1 = ...
0
votes
1answer
261 views

Credit Card Test Confusion

I am supposed to find if cc numbers are valid based on these rules: Multiply every other digit by 2, starting with the number’s second-to-last digit, and then add those products' digits together. ...
0
votes
1answer
40 views

why doesnt this code print the number of bottles of water used? it only stops after prompting user for number of minutes

include include int main(void) { printf("duration of shower in minutes :\n"); int m = GetInt(); printf("minutes : %i\n", m); int b = b; int bottles(int b); { ...
3
votes
3answers
798 views

Problem with format codes

I'm trying to get cs50 IDE to print the size of char, double, float and int. This is what I wrote: #include <stdio.h> int main(void) { char c; double d; float f; int i; ...
0
votes
1answer
66 views

Whats wrong with Vigenere code

This is the cleanest way i can think of of implementing vigenere, but i don't see whats wrong.. the code should work fine.. but its not. Please help string k = argv[1]; int keyLength = strlen(k); int ...
0
votes
1answer
58 views

week7 lecture2 source code speller.php not found

David showed the php version of speller.c but I can't find the code neither on edx, nor on cs50.harvard.edu https://cs50.harvard.edu/lectures/7/w/src https://courses.edx.org/courses/course-v1:...
0
votes
1answer
121 views

What's wrong with this code for the Caesar Cipher?

I created this Caesar Cipher program, but for some reason, I can't find its bug. Here is the code. It compiles, but it just prints out the same thing I enter, for any key. #include <cs50.h> #...
0
votes
1answer
30 views

server gives same error code with different conditions

Below I'm validating the request-line conforms to the spec (printf statements were telling me the errors were from these if statements). The first 3 blocks worked fine independently and together. (e....
1
vote
3answers
461 views

Help with pset1 mario, I don't understand what's wrong with my code

Whenever I do check50 on this code, it gives me lots of errors, and I'm not sure what I'm doing wrong.
-2
votes
3answers
32 views

what is wrong in this program?

#include<cs50.h> #include<stdio.h> /** * program to check my name */ int main(void) { printf("tell me your name\n"); string names=GetString(); if (names = "peter") printf(...
1
vote
2answers
57 views

Submitting Source Code?

When I submit a pset it says I need to submit a source code as well...where can i find that? I think thats why my psets arent getting graded. Please help
0
votes
1answer
67 views

code doesn'work, please help

I tried to write this little piece of code, but I couldn't figure it out entirely. Can someone help me with the missing parts? #include <stdio.h> #include <cs50.h> int main(void) { ...
0
votes
1answer
301 views

How do I unzip source code?

I've downloaded the Source Code files for Lecture 2 to the jharvard directory. How do I unzip them?