Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
The problem set for Week 1 introduces the C programming language.
5
votes
Accepted
pset 1 fatal error: 'studio.h' file not found
This is a small syntax error,
<studio.h>
it should be
<stdio.h>
4
votes
Accepted
Pset1 error: expected identifier or '('
The body of the main function must go between keys, the compiler interprets that as the keys are missing, declaring a function before main (this will be seen later) the solution is simple:
int main(v …
3
votes
Accepted
Pset1: Problem: expected “##\n”, not “ ##\n”
Your own question hides the answer, carefully observe the difference:
"##\n" " ##\n"
There is a space that should not be there, the hashtag must be perfectly aligned to the left. Your program is …
2
votes
Accepted
Pset1: Water- Infinite Loop
What we want is that the user input, with the get_int function is inside the DO-WHILE loop, we do not want to print the number of bottles inside that loop because if i is positive the end condition of …
2
votes
Accepted
How to fix Error: unused variable (Pset 1 - Greedy)
This is a visibility problem, amount only exists inside the loop, the solution is to declare amount hole of the loop:
float amount;
And then inside the loop:
amount = get_float;
1
vote
pset1 less greedy - keep on getting errors
This is a scope problem, the variable "change" declared in main is visible in the whole main program, but when declaring change in the DO-WHILE loop, this second variable is different from the first c …
1
vote
Accepted
pset1 mario (less comfortable), expression error
you have an error in the following loop:
for (d = 7-r; d >= 0; d-)
I guess you want to write:
for (d = 7-r; d >= 0; d--)
1
vote
Accepted
How to solve this cs50 grading issue?
according to my experience it takes a maximum of 2 weeks to get your pset submission graded. usually it is graded much faster. If you've been waiting for more than 2 weeks though,if you continue to ha …
1
vote
Accepted
Trouble with first row of Mario.c
you have all the work done, but in your code, you have the variable hashes uninitialized
for (spaces = 0; spaces <height - hashes; spaces ++)
after an innermost loop hashes is initialized to zero, …
1
vote
Accepted
What's wrong in my greedy code?
your problem is rounding, greedy can work, sometimes without using rounding, but checking 0.41, is not a random choice, be sure to follow the specifications and you must use the function round ()
n = …
1
vote
I'm stressed, someone pls help
your problem is rounding, greedy can work, sometimes without using rounding, be sure to follow the specifications and you must use the function round ()
int cents = round(change*100)
1
vote
pset1water question, does not compile
If you use the GetInt () function you must include the header file cs50.h
1
vote
Accepted
Pset 1-Do While Loop Not Working
while (Height < 0 || Height > 23);
I think this is really what you want
1
vote
My water.c program won't compile - Pset1
%f
is a format specifier wrong for an integer, the right thing would be %i, or %d. Since NumberOfBottles is an integer, the variable is unused, hence the second error, but in this case will be cor …
1
vote
CS50 Pset1 Mario fails test
for (int line= ; line < i; line++)
This is the line that is causing problems, line should be initialized to zero.
line < i
is not the correct value, think a bit about it. For the rest your progr …