[ create a new paste ] login | about

Link: http://codepad.org/PyweSdtd    [ raw code | output | fork ]

C++, pasted on Apr 9:
#include <string>
#include <iostream>

class Paser
{
    public:

        Paser ( std::string _Command );

        std::string Root ( );
        /**std::string Operator ( );

        std::string Path1 ( );
        std::string Path2 ( );

        std::string Variable ( );**/

    private:

        std::string Command;
        std::string CommandReturn;

        void CommandSync ( );

};

int main()
{
    Paser Paserd ( "move /a/b/c/d /ca/b/cd/" );

    std::cout << Paserd.Root ( ) << '\n';

    return 0;
}


Paser::Paser ( std::string Command )
{
    Paser::Command = Command;
}

std::string Paser::Root ( )
{

    Paser::CommandSync ( );

    if ( Command.empty ( ) )
    {
        throw 1;
    }
    else if ( Command.find ( " " ) == std::string::npos )
    {
        throw 1;
    }
    else 
    {
        return CommandReturn.substr ( 0 , CommandReturn.find ( " " ) );
    }
}

void Paser::CommandSync ( )
{
    CommandReturn = Command;
}


Output:
1
move


Create a new paste based on this one


Comments: