it needs to make sure numbers aren't duplicate and are ordered. maybe change my cout statements to arrays?
Thanks.
This is what program is supposed to do
input
Q 1,2,3-5,6-7
output
do problem 1,2,3,4,5,6,7 of Q.

#include <iostream>
#include <cstdlib>
#include <sstream>
#include <string>
using namespace std;

int main()
{


    cout <<"enter the problemset and number""\n";
    //problems represents name and numbers
    string problems;
    char quote;
    char num;
    short number, number2;
    
    //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;
    
        cin>>number;
        cout<<"very beginning\n"<<number;
        
    while(cin.peek() != '\n')
    {
        
        if(cin.peek()==',')
        {
            cin.ignore();
            cin >> ws;
            if(isdigit(cin.peek()))
            {
                cin>>number;
                cout<<"from comma\n"<<number<<"\n";
            }
        }
       
        else if(cin.peek()=='-')
        {
            cin.ignore();
            cin >> ws;
            if(isdigit(cin.peek()))
            {
                cin>>number2;
                cout<<"the value of # is\n"<<number2;
                   
                for(short a=number+1; a<=number2; a++)
                {
                    cout<<"next do #"<<a;
               
                }
            }
        }
        
    }
    
    //check for dulplicate and put in order
        
    // print them all out

    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.