Hot answers tagged

2

The problem lies here: if(isdigit(argv[1][i] != true) You need to fully understand how isdigit() works, specifically the return value, and the numeric value of true. The is() family of functions all return an int. When true, each will return a different number that is a power of 2. This goes back to the history of programming and register values used in ...


1

From Final Steps in the spec: Remember also that every time you encipher a character, you need to move to the next letter of k, the keyword (and wrap around to the beginning of the keyword if you exhaust all of its characters). But if you don’t encipher a character (e.g., a space or a punctuation mark), don’t advance to the next character of k! ...


1

There are a number of issues here. First, the statement if (argc == 2 && isalpha(buk)) is redundant. If argc isn't 2, the program would have exited earlier. Similarly, isalpha(buk) was also checked. (Further, isalpha(buk) only checks one char, not the whole string, so what's the point?) Next, keychar could be a char instead of an int. An int is a 4 ...


1

Interesting interaction between different parts of the code. When there is an 'a' or an 'A' in the key it will fail because of a unique interaction in your code. The code first converts all of the key chars to numbers between 0 and 25 inclusive. The problem lies in the conversion of the a's to 0. Later in the code, the following code appears in the for ...


1

Your thoughts about why you're getting the error are on track. As declared in your code, the variable x only exists in the for loop where it is declared. Outside of the for loop, it is out of scope, so it no longer exists. You need to declare a local variable that you can use as an index for the key. You could redeclare x, but that would be a bad practice, ...


1

It wasn't completely clear, but it seems that you are having a problem with your key advancing when non-alpha letters are processed. If this is the case, the relevant code is what isn't shown. My best guess is that you are using the same index to advance through both your plaintext and your key. Because the key is not always used, (when non-alphas are ...


1

You can still access the lat and lng of a house using something like HOUSES["Adams House"].lat; // access the lat HOUSES["Adams House"].lng; // access the lng and use these along with a method like distance (defined in shuttle.js) to calculate the distance between the shuttle and the house. Update: I'm not sure why you care about the name of the house ...


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