#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{


    cout <<"enter the problemset and number""\n";
    //problems represents name and numbers
    string problems , probtitle;
    string xx;
    bool x=true;
    char quote;
    string str1, str2;
    string begin;
    //gather name
    if(cin.peek()=='"' || cin.peek() == '\'')
    {
        cin >>quote;
        getline(cin,problems,quote);
    }
    else
    {
            getline(cin,problems);
    }

    //gather problem numbers

    while(x==true)
    {
        if(cin.peek()=='0'||cin.peek()=='1'||cin.peek()=='2'||cin.peek()=='3'||cin.peek()=='4'||cin.peek()=='5'||cin.peek()=='6'||cin.peek()=='7'||cin.peek()=='8'||cin.peek()=='9'||cin.peek()==','||cin.peek()=='-')
        {
            getline(cin,problems);
        }
        else
        {
            getline(cin,xx);
            if(xx.compare("\n"))
            {
            x=false;
            }
        }
    }
    cout<<problems;


int length=problems.find(',');
do{
    if(problems.find(',') != string::npos)
    {
        size_t a,b;
        a=problems.find(',');
        b=problems.find('-');


         if(problems.find('-') != string::npos&&b<a)
         {
                    str1 = problems.substr(0,problems.find('-'));
                    cout<<"from do ifif1\n"<<str1;
                    problems=problems.erase(0,problems.find('-'));
                    cout<<"from erase after first erase"<<problems;
                    str2=problems.substr(problems.find('-')+1,problems.find(','));
                    cout<<"from doifif2\n"<<str2;
                    problems=problems.erase(0,problems.find(',')+1);
                    cout<<"the problems left after erase are"<<problems;

        }
        else
        {
                    cout << "from do if else\n" ;
                    str1 = problems.substr(0,problems.find(','));
                    cout<<"from elseelseelseelse\n"<<str1;
                    problems=problems.erase(0,problems.find(',')+1);
        }

    }
    else
    {
        cout <<"No Comma\n";


        if(problems.find('-') != string::npos)
        {
                    str1 = problems.substr(0,problems.find('-'));
                    cout<<str1;
                    str2=problems.substr(problems.find('-')+1);
                    cout<<str2;
                    problems=problems.erase(0,problems.find('-')+1);
        }
        else
        {cout << "\n IF ELSE" ;
                    str1 = problems.substr(0,problems.find(','));
                    cout<<str1;
                    if(problems.find(',') != string::npos)
                    {
                    problems=problems.erase(0,problems.find(',')+1);
                    }
                    else{
                        problems="";
                    }
        }

    }
}while(problems.length()>0 );

What are you talking about? What is the code supposed to do? Can you give sample input, expected output, and actual output?

nvm. going to ask teacher.

Are you implying that your teacher knows more than everyone together, here on Daniweb?
:P

nvm. going to ask teacher.

Smart decision. At least your teacher knows what the program is supposed to do and can ask the questions needed to help you.

Comments
Good point :)
This article has been dead for over six months. Start a new discussion instead.