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 2 continues with the C programming language used in problem set 1.
1
vote
Accepted
Initials.c working fine but not checking
username@ide50:~/workspace/pset2 $ ./initials
Zamyla Chan
ZC
username@ide50:~/workspace/pset2 $ . … /initials
robert thomas bowden
RTB
For the same example, your output will look like:
username@ide50:~/workspace/pset2 $ . …
1
vote
Vigenere Error: \ expected output, but not "\u0000\n"
Try the example of code = "o" and text = "z":
| human expects | computer sees
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
code[0] …
0
votes
Accepted
CS50 Pset2 Caesar - Does not Return 1?
This int l = 'p[i]'; causes l to always have the same value. Which could be anything. Perhaps you meant int l = p[i]; (no tick marks around p[i]). The computer takes this 'p[i]' literally, it does not …
0
votes
initials not accepted by auto check
At least one problem: from the example you see that the output is expected to be on one line.
$ ./initials
Regulus Arcturus Black
RAB
Reading this code it appears the output would look like …
0
votes
Counting apostrophe
Remember, that quotes, either single ' or double " must come in matched pairs. This sentence
if (s[n] == (''')
has only 3 single-quotes '. Since s[n] is a char, the desired char must be enclosed i …
0
votes
Pset 2 ceaser problem
Which number is both less than 0 and greater than 9? No number would ever produce "true".
To test a value between 0 and 9, the conditional is:
if num >= 0 && num <= 9
0
votes
Update to no-vowels: problem returning function result to main(): strange behaviour in CS50 ...
One "problem" is that leeted in the replace function is declared as a Variable Length Array (VLA)
The key takeaway for me:
...lifetime of a VLA ends when the declaration goes out of scope
Change th …
0
votes
My caesar code passes check50, but it does not look right
Assumed that the [italic] text is what some user has typed.
jharvard@appliance (~/Dropbox/pset2): ./caesar 13
Be sure to drink your Ovaltine!
Or fher gb qevax lbhe Binygvar!
Emphasis mine. … If you add the printf, your code would output:
jharvard@appliance (~/Dropbox/pset2): ./caesar 13
Type text for encryption:
Be sure to drink your Ovaltine!
Or fher gb qevax lbhe Binygvar! …
1
vote
Accepted
CS50 pset2 vigenere array
It's a contract violation. From man atoi:
Name
atoi, atol, atoll, atoq - convert a string to an integer
Synopsis
.....
int atoi(const char *nptr);
argv[1][a] is a char not a char * (string).
Since a …
5
votes
Accepted
What does " 'GetString' is deprecated" mean? How do I fix it?
From the What's new? in CS50 2017 document:
CS50 Library
To be more consistent with stylistic conventions in C, we’ve renamed the functions in the CS50 Library as follows:
GetChar is now get_char
Get …
0
votes
PSET2: Readability code giving wrong grades
Looks like l is trending high. It counts every character in the text except the terminating null byte (which never makes it into the loop anyway!). Check out man isalpha to get back on track. This ma …
0
votes
Accepted
Problem with isdigit function
Recall from Week 2->Walkthroughs->ascii-0 David's discussion of the mapping between numbers and letters. (If you haven't seen it, now would be a good time, and ascii-1 too). The characters '0', '1', . …
0
votes
pset2 initials checking problem?
tells you what output your program produced:
but not "2\n4\n\"\n"
The example in the pset instructions is very specific about what the autograder (check50) expects:
username@ide50:~/workspace/pset2 … initials
robert thomas bowden
RTB
It looks like your program produced this for the similar test in check50 (which should produce the same output as the example above):
username@ide50:~/workspace/pset2 …
1
vote
Accepted
Vigenere corect encryption with weird letters at the end
It's the thing that makes a string a string. The null terminator. Rewatch a couple of minutes of Week 2, 2nd lecture starting around 9:00. That's where Rob talks about the null terminator ('\0'). This …
1
vote
still practising initials 1
First, a warning about your approach. Even though you say "practising", how will your code handle this example "robert thomas bowden" from the spec? What about "john jacob jinglehammer jones"?
The co …