Hello! I'm a newbie, let me know if I post anything against etiquette.
My program keeps crashing the console.
Is there something wrong with arrays of strings?
it should ask for the number of stores to compare, and then store the names of up to ten stores in a name array, and the price of a certain item for each of those 10 stores in another price array. It should then print all stores and all prices. Then it will compare the prices and output the lowest price and what store it's from.
I've been trying different things for like 3 days on and off with this. This is my most current iteration.
size is a variable. This means it can change in value. The size of an array must be constant and must be defined before the program can compile. Since you know you only want an array of 10 or less. Go ahead and get your array at max size like this
I moved the array definitions below the cin statement and it works. important lesson on stupid mistakes...
Don't do that.
Of course you can place the definitions where you like, so long as you make the size a CONSTANT.
What is happening here is that you are relying on a non-standard compiler behaviour. That's the wrong way to go about learning C++, because it means if you use a different compiler, your code will not work. Your aim should be to learn how to write code that will work on any compiler which complies with the C++ standard.