提问逐个输出
这个程序是想让字母一个一个的显示在屏幕上,有一定的时间间隔,f()函数的间隔大概
是半秒,但是如果是没有下面的cout<<endl ,则大概等四五秒以后将what is your name
一并输出,加上cout<<endl 以后则每半秒输出一个字母并换行。不知道为什么。
还有,要是想让汉字也一个一个的输出应该怎么办呢?
#include "stdafx.h"
#include <iostream.h>
void f()
{
long double s=0;
for(long double i=0;i<10000000;i++)
s+=i;
}
main()
{
const char* str="what is your name?";
while(*str)
{
f();
cout<<*str++;
//cout<<endl;
}
int a;
cin>>a;
}