print prompt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int main()
{
    string ex;
    while(true)
    {
        cout<<'>';//print prompt
        cin>>ex;
        if((! ex.compare("quit")) || (! ex.compare("q")))
            return 0;
        parex e(ex);
        e.calc();
        if(e.is_error())
            cerr<<e.err_message()<<endl<<endl;
        else
            cout<<e.result()<<endl<<endl;
    }

    return 0;
}


What should I do if I want the prompt to be printed when I just press <ENTER>?
Just like the shell does.


><ENTER>


the above becomes below:

>
><here is cursor>
use getline instead of operator>> http://www.cplusplus.com/reference/string/getline/
I have made it done. Thank you!
Topic archived. No new replies allowed.