This code returns an error stating that 'the stack around variable "deck" was corrupted."
Being somewhat new to C++ I'm not overly confident with what this means or how to overcome it. Please excuse me if it is a very simple error as, like I have stated, I am a newbie. Also I'm sure there are many better ways to generate a deck of cards. I think the recurring if statements are most likely causing me an issue yet I'm not sure how to write the program without them.
Any help is greatly appreciated. Thanks in advance, James.
On lines 14 to 16. You declared an array of size 53 (which is the wrong number of cards in a deck) which means the valid indices for the array are from 0 to 52 (deck to deck). However, your for loop continues an iteration when counter = 53, so you attempt to access deck, which is one step out of the array boundaries. You grabbed something you weren't supposed to and modified it, corrupting the stack.
You should reconsider your design, so you don't have to use so many else if statements.
Being somewhat new to C++ I'm not overly confident with what this means or how to overcome it.
Usually it means you are stepping outside the bounds of an array. In this case, the error suggests that the array is "deck".
If you note, you are stepping out of bounds here:
1 2 3
int deck; // <- deck is size , which means  is last legal element to access
for(int counter = 0; counter <= 53; ++counter)
deck[counter] = counter; // <- accessing element .. OUT OF BOUNDS