Questions tagged [week1]

The tag has no usage guidance.

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

Why do I get this “expected expression” error?

Like mentioned in the title, I get this "expected expression" error when I try to convert my amount from float into int type. Am I doing the conversion wrong ? Or is there something else I'm ...
0
votes
1answer
9 views

No such directory - Week 1

I am unsure why my mario.c and mario are not showing up as directories? I am sure this is a very simple fix. However, I seem to be at a loss of what to do! I would appreciate any feedback! Thank you!!
1
vote
2answers
47 views

Can we use math.h and strings.h for credit.c

I can only think of ways to do credit.h using functions from string.h and math.h, but they're not covered in the week's lecture. Are we allowed to use them?
0
votes
1answer
49 views

Trying to change directory in week1 example hello1.c

I am trying to change directory in week1 tutorial example hello1.c, but its showing an error message bash: cd: dropbox: No such file or directory
0
votes
0answers
11 views

Can't use the \n command to prompt output one line below

Can't get the \n (e.g., "What's the price?\n" ) to space my $ one line below output, albeit using lecture code. Anyone knows what might be the problem. Regards #include <cs50.h> #...
0
votes
1answer
38 views

Prompt a user for a number. My code has an endless loop

i am trying to build a code in which the user should input a number between 1-5. In any other case the program should request the user to input a new number. My problem is that the program is going ...
0
votes
1answer
19 views

Week 1 Credit; Not Creating Variable

I'm starting the week 1 credit problem, however, when trying to set together every second digit it simply does not print. Could you help me identify where I went wrong? Thanks! #include <stdio.h>...
0
votes
2answers
99 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
2answers
23 views

Else If Boolean Statements of Equality In the Case of Complex Numbers

In the lecture for Week 1, Professor Malan said that in an if statement, the third boolean expression (else if (x ==y)) is redundant or implied, since logically, if it is false that a number is ...
0
votes
0answers
19 views

cs50 IDE Week 1 submission

I have just finished week 1 and now i m trying to submit it, however I cant seem to do it. How do you submit week one (hello.c) on GitHub? I've looked on GitHub and on the Edx site, but still cant ...
1
vote
1answer
23 views

Cant get past the ls command in hello.c

I cant get past the List command in hello.c, and i'm not sure if i'm supposed to get something in the terminal after i type in ls, so i kept going and typed clang and i get the error message. I've ...
0
votes
3answers
3k views

Week 1: get_int & get_string errors

Fro the files int.c and string.c, I copied the code from the lecture exactly, and was receiving errors, then modified the code according to suggestions online by adding #include <cs50.h>and I'm ...
0
votes
0answers
7 views

can I use signed or unsigned instead of int

in minute 1:26 he declares n as int then writes get_postitive_int ,but shouldnt he use unsigned int for positive ? and why does it need a separate function to get positive values since unsigned int ...
0
votes
0answers
27 views

what are questions about my code, the week1 credit assignment

#include <cs50.h> #include <stdio.h> int length(long long n); int lastdigit(long long n); int stay(long long n); int addmutiply(long long n); int odd(long long n); int digit2(long long n);...
0
votes
1answer
93 views

Credit.c works, but not completely?

So I finished credit.c today and was trying out different numbers from the paypal website the course provided and got some unexpected results and don't know what to do with it. When I type in valid ...
0
votes
1answer
354 views

Can't use get_long_long();

So somehow I cant use the get_long_long(); function. It lets me declare the variable, but I cant get any user input for it. Here's my code: #include <stdio.h> #include <cs50.h> #include &...
0
votes
1answer
25 views

Transform function into a loop or similar

So my problem is in problem set 1 of week 1 of the CS50 Harvard course. The task was writing a program that calculates the smallest amount of coins possible when getting change. I've already written ...
0
votes
1answer
499 views

CS50 PSET 1 Hacker Bad Credit Code

The goal is to find if a credit card number is valid. Complete Instructions Here: https://cdn.cs50.net/2015/x/psets/1/hacker1/hacker1.html#bad_credit Can I please know what makes my code fail? (I ...
1
vote
1answer
1k views

Why do I not have to link stdio.h while compiling with clang?

To compile this source code with clang, we had to link "cs50" library like this: clang hello.c -lcs50 but we did not have to link "stdio". why? /* hello.c */ #include <stdio.h> #include <...
0
votes
1answer
320 views

get_int variable in mario causing errors

Hi I'm getting an error that says "x" is an unused variable. And I'm also getting errors every time I try to use "x". I have reviewed David's get_int example from Lecture 1: int main(void) { ...
0
votes
1answer
161 views

Week 1 cash.c assignment: How can I get a variable to mutate as it gets operated on?

the way my code works is to reduce c as we count out coin-types. But I'm getting errors. #include <cs50.h> #include <stdio.h> int main(void) { float c; do { ...
0
votes
1answer
311 views

Switch(c) undeclared identifier

I am trying to compile the example codes from the shorts with Doug Lloyd. I was putting together the switch.c example, and there seems to be a problem with the c of switch (c). Here is what I have. ...
0
votes
1answer
53 views

Can't compile adder from week 1

im trying to compile my program but a problem keeps popping up and i cant seem to understand why. Here's the program and the problem.
3
votes
1answer
659 views

Week 1 compiling String.c using clang instead of make

in week 1 as I understood : make= compile the file and name the compiled file with the same name. clang= compile the file with the default name. when I've used make it worked and when I used clang it ...
-1
votes
2answers
53 views

Week 1 : After using the cp command and copying the file, the duplicate file does not run and prompt appears saying “Nothing can be done”

Week 1 : After copying a file, can a duplicate file be compiled and run?
0
votes
1answer
341 views

the inbuilt cs50's library functions not working

For god sake this one isn't working. Can anybody help? Thanks in advance #include <stdio.h> #include <cs50.h> int main(void) { string s = get_string(); printf("Hello, %s\n", s); }...
0
votes
1answer
98 views

week 1 string.c errors

I am going through week 1, and once I enter this: #include <cs50.h> #include <stdio.h> int main(void) { string name = get_string(); ...
0
votes
2answers
23 views

Not a problem set, but a question about the “sizeof” example from week 1 walkthroughs

I've been trying to follow along with all the examples in the walkthrough and there's something that I can't get to work and I can't for the life of me figure out WHY I keep getting this error message....
0
votes
1answer
50 views

Last program from the first half of the lecture in week one?

I tried to run the last program from the first lecture video of week 1, and I got this error: clang -ggdb3 -O0 -std=c11 -Wall -Werror pain.c -lcs50 -lm -o pain pain.c:61:1: error: type specifier ...
0
votes
1answer
36 views

why is no “\n” needed after GetString?

Watching the first week 1 lecture, they went over how you need "\n" to print a new line. However in the example: { printf("Your name please: "); string s = GetString(); printf("hello, %s\...
0
votes
1answer
49 views

week 1 get 4 errors when compiling hello-1

I keep getting the following 4 errors when I try to make hello-1
0
votes
1answer
608 views

Permission Denied in pset1

I am stuck in week 1 lectures. Initially after watching the videos I was able to run the codes, 'make hello' and './hello.c', then after an update to the CS50 appliance the codes wouldn't run any ...
0
votes
1answer
31 views

Why does PrintName return void?

Okay so in the PrintName function, it contains a printf function. However, I read that printf returns a value which is the number of characters. Shouldn't PrintName hence return an int as well? Thanks!...
-1
votes
1answer
148 views

How to fix the “nothing to make” error? [duplicate]

I just made a new file called mickey.c (basically a version of hello.c). I went into the directory and executed the command make mickey.c it says "nothing to make". here is the output from terminal:...
0
votes
1answer
826 views

How should I take notes for the lectures?

learners! I'm glad to be a part of this community. About our course, CS50, I was frustrated because in our university we didn't learn how we could take notes from the course. Our instructors start ...
0
votes
1answer
74 views

CS50 Appliance compiling error!

Just started cs50 on edx a week ago. Just finishing the walkthroughs for Week 1. In the walkthroughs, there is a one video about "Switch" and "Cases". Ive written the code correctly, I think, but ...
0
votes
2answers
177 views

Week 1 - Conditions - error expression result unused (expect ; at end of if else)

Error: expected expression (see photo) It's a very basic program and I'm sure I've made a simple syntax error. There shouldn't be a ";" at the end of the else line and I have included the ; at the ...
0
votes
1answer
279 views

The compiler Clang isn't showing

The compiler Clang isn't showing and I'm at a complete lost of why it isn't. Please help me. bash: clang: command not found cs50
0
votes
0answers
51 views

Why is -ls stdio.h not used?

During the Week 1 lecture continued at approximately 31 mins in the instructor talks about telling clang to link cs50 into his program. I was wondering why you don't need to tell clang to link in to ...
0
votes
1answer
40 views

Where can I download “src1m” folder of files used in week 1 lecture?

I want to download and run the files David used in the week 1 lecture, the folder's titled 'src1m'.
0
votes
2answers
394 views

CS50 commands, standard commands - is there any literature and who did that? [closed]

I am on week 1 and it is a lot frustrating to me. I certainly am not good with computers. When in first part of the lecture, teacher says things such as someone invented it, computer looks for it... I ...
0
votes
2answers
817 views

Do we need to return 0 in C?

I found a lot of C tutorials on the internet ending their main functions with return 0;, but I don't see David doing that. Can anyone explain to me please? I've only finished watching Week 1 lectures ...
0
votes
0answers
46 views

Pset0 isn't under Week 0 but, Week 1. Bug? [duplicate]

The Problem Set 0 which was previously under Week 0 is now displaying under Week 1. Week 0 does not display any Problem Set, and the Problem Set of Week 1 shows under Week 2? Is this some kind of bug ...
0
votes
1answer
47 views

Trying to compile f2c.c from walkthrough week1 without success [duplicate]

I'm trying to compile the programming from the walkthrough week1 f2c but it doesn't work. I don't know what I'm doing wrong. When I type in "make f2c" it returns *** No rule to make target `f2c'. ...
1
vote
1answer
278 views

Where is the CS50 style guide document?

In his short on C style in week 1, Tommy refers to a style guide. I can't find it. Where is it? I have already looked through the cs50 site and can't find such a document there.
0
votes
1answer
694 views

hello.c when I want to run it says:No such file or directory

I am currently watching lecture one in week 1 and have the problem with hello world example professor Malan explained.I do everything by the instructions,save it in Dropbox folder as hello.c.In ...
4
votes
2answers
166 views

What is the difference between ++i and i++?

After watching Precedence in the Week 1 Shorts, I know what i++ means, but I still don't understand: What is the difference is between i++ and ++i?
-1
votes
1answer
50 views

Is there a mistake in the slides of Section 1?

I am reading the slides for the Section 1 (2014) which I downloaded from here. (I cannot view the video because of less bandwidth). I am on this page (28): The condition given in the code is that we ...