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 |
2
votes
Accepted
Why is my get_positive_int code not working? (I seem to do everything right!)
you have a small typo error in the function you have written:
int get_positive_int
versus:
int get_positive_int_
0
votes
while (n<1) ----- Why?
I don't think you have understood how a DO-WHILE loop works. The difference with other loops is that THIS is going to be executed at least once, regardless of the condition we impose. With this we get …
1
vote
CS50 Format Specifiers in c
I assume you're referring to the format specifiers of printf function, these are the same as those of the standard version of C, but if you're mean the cs50.c library uses its own data types in order to …
0
votes
pset1 Greedy Algorithm
We have a small syntax error the binary operator "greater than or equal to" is written
>=
And no =>
1
vote
pset 2 caesar help!
encrypted character, the following works:
if (alphabets_upper[index] == s[i])
{
int cipher = alphabets_upper[(index + key) % 26];
printf("%c" … , cipher);
}
if (alphabets_lower[index] == s[i])
{
int cipher = alphabets_lower[(index + key) % 26];
printf("%c" …
1
vote
Got into an unexpected error while compiling the code
If you use the IDE, the easiest way is to use the make command, if not, you must use the -lcs50 option when compiling to avoid the error indicated
1
vote
pset2 substitution
In effect it is not an ascii value for an alphabetical character, if, however, it is not what we are trying to do, but what we want is to substitute the m character for the corresponding one of the ke …
0
votes
pset2 vigenere; isalpha is accepting numbers in argv[1]
"The values returned are nonzero if the character c falls into the tested class, and a zero value if not." We can use that to build the if condition, the correct way would be:
if (! …
1
vote
Accepted
Vigenere:non-alphabetical character
i<= strlen(keyword)
keep in mind that keyword begins with the zero subscript so that if its length is given by strlen the one index is strlen(keyword) - 1, the correct statement would be:
i < strle …
0
votes
Accepted
Why do header files have different symbols in C?
< stdio > is an instruction that tells the compiler to include that file when compiling and to search for that file in the default directory, usually / usr / include, if we use the quotes the compiler …
1
vote
Pset1, Cash problem
Just a couple of things, you are assigning an operation between variables of type float to a variable of type int. When this is done the result is truncated, it is not rounded, hence the results you g …
0
votes
Accepted
pow() function of a float
The division between two integers in C differs from the rest of modern languages, here we are left with the integer part of the quotient and we eliminate the decimal part (k becomes integer and loses its …
0
votes
Accepted
What is correct syntax when declaring a pointer? (i.e. where to place the *?)
The most important thing is that both forms are correct, the way to write it is just a question of preferences, write it in the way that is most clear to you, that if, you must be consistent with the …
1
vote
pset1 Error: indirection requires pointer operand
What is supposed to be * card? We can not apply own operators of a pointer to a variable of integer type in this case. It seems that the compiler is interpreting this as an indirect operation of a poi …
1
vote
Receiving 'error: expected expression' for code inside if statement (pset1)
To evaluate the right side first we must put the parentheses on the right side of the identity, not the operator == itself
if (counterCardLength == 15 && FindFirstTwoDigits == (34 | 37))
if (a == (1 …