I was working on the being of a cash register and I was testing this portion of my code. It compiles, but when I input my first items name I get a windows error and the program ends. I would appreciate any help an/or explanation.
#include <iostream> // allows output and input
#include <iomanip> //allows i/o manipulation
#include <stdlib.h>
#include <fstream> // allows file i/o
#include <string> // allows the use of strings
//declares variables
int current_input_number;
int number_of_items;
main()
{
using namespace std;
system("COLOR 0a"); // changes color
//declares an array of strings
string item_name[number_of_items];
cout << "How many items does the customer have? \n";
cin >> number_of_items;
for (current_input_number = 1; current_input_number < number_of_items; current_input_number++)
{
cout << "Please enter product number " << current_input_number << '\n';
cin >> item_name[current_input_number];
}
for (current_input_number = 1; current_input_number < number_of_items; current_input_number++)
{
cout << item_name[current_input_number] << '\n';
}
cin.ignore(2);
return 0;
}