Hi please see the link for the code I am working with. I think the layout is correct but cannot seem to find the correct algorithm to solve this problem.



1 Answer 1


I haven't run your code, but I have noticed a couple of points that could potentially cause a problem. Firstly in your printf statement on your first shift algorithm

printf("%d", ((p[j]-65)) + (toupper(k[count]-'A')) %26 + 65);

you have used %d as a placeholder instead of %c; %d is used for numbers so you are likely to get a numeric value printed out here.

I believe there could be another possible issue with your k[count] because you are incrementing count using count++ before you have used the original value. So you won't be accessing the first letter in your key (key[0]) because you have already changed 0 to 1 before it is used.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .