求大神解释关于如何让运行结果持续显示,而不是一闪而逝
二胖小哥 2014-04-09 08:53:26 #include<iostream>
int main()
{
using namespace std;
char ch;
int space=0;
int total=0;
cin.get(ch);
//cin.get();
while(ch!='.')
{
if(ch==' ')
{
++space;
}
++total;
cin.get(ch);
//cin.get();
}
cout<<"space:"<<space<<endl;
cout<<"total"<<total<<endl;
cin.get();
return 0;
}
这个代码是书上的,应该没有错,注释部分是我认为保存结果而加上的,但是一直摁回车都不显示结果,但是不加上的话 却不保存运行结果的界面。