Hot answers tagged

2

It's not so much you "can't" pass it as you "don't" pass it. There is no input element whose name attribute is "name". After edit: from the screenshot, you should notice it's using a "get" method because, well it says so, and there is a the query string. You'll either need to add a method="post" attribute to the form element, or test for a GET and look at ...


2

a do..while loop executes the code in its body at least once then keeps executing it as long as the continuation condition is true. this means that you want the continuation condition to be true (you want the loop to repeat) if the user enters a value that is not between 0 and 23 and false otherwise. your continuation condition is: ((n < 1) && (...


1

The problem lies here: for(int i = 0; i < keyL - 1; i++) { for(int j = i; j < keyL; j++) { if(key[i] == key[j]) return 0; } } When the loop runs the first time, it will always fail because i == j at the start. It's comparing the first letter in the key to itself. It should start with j = i+1. There may be other ...


1

Interesting issue. So, what's actually stored in n? int n = (int) &argv[1]; That & that appears before argv[1], means to use the address of argv[1], so it's inserting the address, not the contents of argv[1] in n. If you were to print n, you'd see it change each time you ran the code. But fixing that still won't give you working code. argv[] ...


1

While the output from your program may be encoding the plaintext, the problem lies elsewhere. The program spec says to prompt for input. The code above merely waits for input, without a prompt. Perhaps a review of the program spec is in order? There is specific instruction about the prompt and what follows. One of the hidden lessons in the early psets is ...


1

It can be challenging specially that you're still in the first few weeks. There are many I/O functions in the C standard library that you can use for that purpose. One of them is fgetc. Execute man fgetc in the terminal for more info on that function! The approach could be as follows: // read number 1. declare a string called num // make sure it's big ...


1

This is sketchy: foreach($result as $result): ?> because the var names are the same (and I'm not sure about : in php). Wouldn't the proper syntax here <option value="$result["name"]"> be <option value="<?= $result['name'] ?>">? Syntax of the echo is not what you want in the second version since it will literally echo "<option> $name &...


1

Fseek works by moving the file pointer, indicated by the FILE pointer in our case, forward or backward. So whenever you use functions that work with file streams, you should keep in mind where the file position pointer. So when you make changes to the output file using fputs, you are moving the file pointer. Clearly, you can see why when you try to read and ...


1

It can be done, and in fact, will be done as part of some of the last psets. But since this is a teaching environment, and one of the things this class teaches is how to find out how research questions like these, I'll point you in the right direction. ;-) Like all programming problems, it's best broken down into parts. In this case, you want to: Read in a ...


Only top voted, non community-wiki answers of a minimum length are eligible