New answers tagged

0

Are "all those numbers" formatted correctly? It looks like neither user.cash nor Total Funds is formatted as with usd. The check is using some kind of pattern matching, so the output must match exactly (comma separated thousands; 2 decimal places). Please add some color to "cause login to fail". Does it give an error? If so what? Is the ...


0

Very interesting! Did you notice that in the two failing cases, all of the pixels on the right and bottom edges are incorrect? So, that says there's something wrong with the code that handles those two edges. Now, look at the relevant code for the lower right pixel. Remember that an array declared as array[10] has valid elements from 0 to 9, not 10. ...


1

"Is it implicit in the above code that if vote returns true then the vote function runs as normal and updates the preferences array?" Answer: No. The vote function runs and then the result is evaluated. If vote returns true, the function has already updated the preferences array (assuming, of course, it's been written correctly :)


2

You return prematurely. Simply finding a vote count smaller than the max is not enough. You need to keep going until you've looked at all the candidates, and then return the smallest vote count. // Return the minimum number of votes any remaining candidate has int find_min(void) { int minVote = MAX_VOTERS; for (int x = 0; x < candidate_count; x++) ...


1

The code is not counting the number of digits correctly. It's generating counts that are one less than the actual length. You can verify this by inserting printf("cc_length = %i\n",cc_length); after the length is calculated. This is the root cause of the seg fault. Here's how. The number of elements in the array int arr[cc_length]; are one less ...


0

You've misinterpreted what you are looking at. In the debugger, it's showing **argv, or the contents of the very beginning of the array. In other words, it's showing you the first char in argv[0], or "." Keep in mind that argv[0] is the command used to call the program, or "./caesar" You can validate this by adding argv[1] to the vars ...


Top 50 recent answers are included