C++文件输入输出有关问题

C++文件输入输出问题ofstream outFile(file1.txt)string stroutFilethese words are from Programe

C++文件输入输出问题
ofstream outFile("file1.txt");

string str;
outFile<<"these words are from Programe!\n";


ifstream inFile("file1.txt");

while(inFile>>str){
cout<<str<<" ";
}
cout<<endl;

以上代码为什么不能输出:these words are from Programe!?

[解决办法]
没有flush?