A C++ Program to Create an Array |
PROBLEM
Write a program that will accept a list of products and store them in an array.
SOLUTION
EXPLANATION
In the program, we have declared a variable named prodNum which will store the size of the array. Then we took input of prodNum from that user. After that, we declared string type array products with the size that we took from user as prodNum.
We have used two for loops in this. One loop is for storing the user inputs in the array. And the other loop is used to print the data items of that array.