I have this code currently in which the user would enter a number for how many numbers they want in the array. followed by '12345' however about a second after writing it i realized this would only work if they entered number 0-9 anything in double figures or more wouldnt work.
int numberOfValues;
cout << "Please enter the amount of integers you want in the array" << endl;
cin >> numberOfValues;
int valuesArray[numberOfValues];
string valuesString;
cout << "Please Enter " << numberOfValues << " numbers" << endl;
cin>>valuesString;
for(int i = 0; i < numberOfValues; i++)
{
valuesArray[i] = valuesString[i];
}
return valuesArray;
im thinking that the best way to do this would be for the user to enter numbers separated by a comma and to split them afterwards (iv done this same little porgram in java and trying to change it to C++ for my own personal learning) like in java i used string.split(",") i was wondering if there is anything similar in c++??