Questions tagged [week1]
The week1 tag has no usage guidance.
55
questions
0
votes
1
answer
28
views
Week 1 Credit, two visa cards #s not working
I've been stumped on Credit for a few weeks, I've learned a LOT in writing my code and I have fixed many errors. My code now passes all the checks except for these two errors and I cannot figure out ...
0
votes
1
answer
21
views
Week1 Cash problem scoping issue? Cents not updating
I have been trying to solve the cash problem but i think i'm running into problems with scoping between prototype, main and function updating the cents variable. I have tried a variety of variations ...
0
votes
1
answer
19
views
Cs50 week 1 problem (make: *** [ ] Error 1)
please I need some help to understand this error
im I doing smth wrong ?
0
votes
1
answer
47
views
Week-1 problem set credit
I have started taking the CS5 lessons and while I run my code for the week-1 credit problem, the terminal always shows the output as "INVALID" or anything that I insert in the second last ...
0
votes
1
answer
109
views
Can't seem to get total number of years to print properly in Lab 1
I'm new to coding and I've been having trouble with Lab 1. I was able to get the program to properly ask for a start and end size, but the number of years is not listed.
Here's an example:
population/ ...
0
votes
1
answer
306
views
What is the meaning of ”can't check until a frown turns upside down“?
This is my code for the CS50 week 1 homework called Meal time and it can work correctlt.
def convert(time):
y,z = time.split(":")
y=float(y)
z=float(z)
time=y+z/60
return(time)
def main():
...
0
votes
2
answers
91
views
I want to understand the int data type. Why is the range 2^-31 to 2^31 - 1 when there are total 32 bits only. Should it not be 2^-16 to 2^16-1?
So my question may be very basic. But I am pretty new to computers.
If there are 32 bits in the int data type then it means there are 32 places where we can write either a zero or a one (if I am ...
0
votes
4
answers
2k
views
Cant get Codespace to work
Im up to the "Hello" module, week 1. Ive never programmed before so setting up copespace has been quite frustrating. I cannot get it to work. Can someone please help me? I want to get ...
0
votes
1
answer
28
views
week 1 no workspace?
I'm trying to get through the first 15minute of the lecture and already lost :( I tried to go through other questions that recommends to find the right ~workspace and ~pset1 but I don't know how to go ...
1
vote
1
answer
332
views
problem with credit with this numbers (369421438430814 & 5673598276138003)
I just finished solving the credit problem and regularly used check50 to see my results, and then this happened.
check50 sees that these numbers :
369421438430814
5673598276138003
are invalid, even ...
0
votes
1
answer
162
views
I don't understand the comments from check50 on my lab 1 submission. could anyone help please?
This is my code
#include <cs50.h>
#include <stdio.h>
int main(void)
{
// TODO: Prompt for start size
int s;
do
{
s= get_int("Start size: ");
}
...
0
votes
1
answer
49
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!!
0
votes
1
answer
606
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
1
answer
39
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
2
answers
564
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
2
answers
78
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 ...
1
vote
1
answer
130
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
1
answer
79
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
1
answer
166
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
1
answer
585
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
1
answer
58
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
1
answer
201
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
1
answer
467
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
3
answers
4k
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
1
answer
1k
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
1
answer
64
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
1
answer
902
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
2
answers
74
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
2
answers
146
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
1
answer
449
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
1
answer
116
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
1
answer
516
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 ...
0
votes
2
answers
30
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
1
answer
55
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
1
answer
53
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
1
answer
162
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
1
answer
67
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
1
answer
42
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
1
answer
1k
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
1
answer
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
2
answers
533
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
1
answer
62
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
1
answer
327
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
0
answers
59
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
1
answer
879
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
1
answer
42
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'.
2
votes
1
answer
3k
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
2
answers
405
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
2
answers
1k
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
0
answers
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 ...