我的问题是,我如何获得第10号——0号——在同一行文上打印,用WIN32或GNUC编辑,以简单的方式,如我以下的法典,相互重复书写:
This is what I have so far:
#include <iomanip>
#include <iostream>
using namespace std;
#ifdef __GNUC__
#include <unistd.h>
#elif defined _WIN32
#include <cstdlib>
#endif
int main()
{
cout << "CTRL=C to exit...
";
for (int units = 10; units > 0; units--)
{
cout << units <<
;
cout.flush();
#ifdef __GNUC__
sleep(1); //one second
#elif defined _WIN32
_sleep(1000); //one thousand milliseconds
#endif
//cout << "
";// CR
}
return 0;
} //main
但这只是印刷品:
10 9 8 7 6 5 4 3 2 1