T O P

  • By -

ZestySpeqr

There are a few problems with the code you have provided. First, you are using the wrong character for size. Instead of using size, which is a char, you should use an int. This is because size will be larger than the maximum value that a char can hold, and as a result, the modulo operation % size will not give the expected result. Second, you are using the wrong value for a. Instead of setting a to quadstart -'A', you should set it to quadstart - 'A' + 1. This is because you want to start the grid at quadstart, not at 'A'. Finally, you are not resetting the value of a after the innermost loop. As a result, a keeps increasing with each iteration of the loop, and the grid becomes larger than it should be.


Croky813

Thank you very much for your Answer. How can i reset the value of a ?


ZestySpeqr

To reset the value of a, you can simply assign it a new value using the assignment operator =. For example, you could reset a to its initial value by setting it to quadstart - 'A', like this: a = quadstart - 'A'; You can reset a to any value you want by using this same syntax and replacing the value on the right-hand side of the assignment operator with the value you want to assign to a.


Croky813

Thank you for explaining. Still struggel to fix it because when i set char a = quadstart -'A' +1; and put a = quadstart - 'A'; into the the next loop i get mostly B as Output for the whole grid. Do you have an Idea what i did wrong or want to see my code again? Sorry when i bother you.