Keeping The Output Window Open

Hi all,
My program accepts strings, places them in a vector and then "bleeps!" out words of my choosing, in this case, "broccoli". But I'm having trouble keeping the output window open even with my Keep_window_open() implementation. Any help is greatly appreciated!

#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "cmath"
using namespace std;

inline void keep_window_open()
{
cout << "\n\nPlease enter a character to exit: ";
char ch;
cin >> ch;
}

int main()
{
vector <string> sentence;
cout << "please enter a sentence." << endl;

for(string word; cin >> word;)
{
sentence.push_back(word);
}

for(int i=0; i<sentence.size(); ++i)
{
if(sentence[i] == "broccoli")
{
sentence[i] = "bleep";
cout << sentence[i] << " ";
}
cout << sentence[i] << " ";
}

keep_window_open();
}
Discussed at length here... worth the read.
http://www.cplusplus.com/forum/beginner/1988/
Last edited on
Thank U Stewbond.
Topic archived. No new replies allowed.