how can i cast a string to int when i have this
//input problem numbers
cout<<"\n""enter the numbers";
//numbers represents what they input
string numbers;
getline(cin,numbers);
//position represents at what location value comma is
int position;
while(numbers.find(',') !=string::npos)
{
//print out what the user inputs
//used to split up part between each comma
string substring;
//find position of each comma
position=numbers.find(',');
//represents first character in string numbers
int intial=0;
//find each part which contains a "-" and a number before the comma and store it in variable substring
substring=numbers.substr(intial,position);
numbers=numbers.erase(intial,position+1);
//if it has a - and a ' then do this
if(int found=substring.find('-') !=string::npos)
{
int beginValue = atol(substring.substr(0, found));
int endValue = atol(substring.substr(found+1));
int size=endValue-beginValue;
int substring_list[size];
for(int a=0; a<=size; a++)
{
for(int i=beginValue; i<=endValue; i++)
{
substring_list[a]=i;
}
}
cout<<"\n";
}
}
return 0;
}