Can't figure out last line! Help

I recently just started learning C++ and i was just messing around trying to create a first and simple program. I cant see to figure out why it wont output the last line. Can someone tell me why? Thanks in advance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#include <iostream>
#include <string>

using namespace std;

int main ()
{
    string mystr;
    cout<< "What is your name? ";
    getline (cin, mystr);
    cout<< "Hey " << mystr << ", What are you up to? ";
    getline (cin, mystr);
    cout<< mystr << "That's cool!  Me Too!";
    return 0;
}
Last edited on
Well, if it closes before it outputs the last line (on windows xp) then add system("pause); before your return statement. Hope that helps.

Mike
Yep. It worked. Thanks again.
Topic archived. No new replies allowed.