its in the num=="-".
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
cout <<"enter the problemset and number""\n";
//problems represents name and numbers
string problems;
char quote;
char num;
string number;
//gather name
if(cin.peek()=='"' || cin.peek() == '\'')
{
cin >>quote;
getline(cin,problems,quote);
}
else
{
while (!isdigit(cin.peek()) && !isspace(cin.peek()))
{
(char)cin.peek();
problems += cin.get();
}
}
//gather problem numbers
//cin >> num;
int lastdigit=0;
while(num != '\n'){
cin.get(num);
// can't use cin >> ws since it would eat the newline
/* while (cin.peek() != '\n' && isspace(cin.peek()))
{
cin.ignore();
}*/
if(num==',')
{
if(isdigit(cin.peek()))
{
cin.get(num);
cout<<"from comma"<<number<<"\n";
}
}
else if (num=='-')
{
if(isdigit(cin.peek()))
{
// remember num
int b=atoi(cin.get(num));
for(int a=lastdigit+1; a<=b; a++)
{
num++;
}
}
else if(cin.peek()=='\n')// must be a newline!
{
//
break;
}
else if(isdigit(cin.peek()))
{
}
if(isdigit(num))
{
lastdigit=num;
}
number=number+num;
}
cout<<"the final number is"<<number<<"\n";
// print them all out
return 0;
}