小球
2025-12-19 22:01:23
发布于:浙江
#include <iostream>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
using namespace std;
int main() {
const int t=10;
const int s=500;
for(int i=0;i<t;i++) {
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
cout<<"【5秒小球移动动画】"<<endl;
cout<< "------------------------"<<endl;
for(int j=0;j<i;j++){
cout<< " ";
}
cout<<"●"<<endl;
cout<<"------------------------"<<endl;
cout<<"剩余时间:"<<(5-i0.5)<<"秒"<<endl;
#ifdef _WIN32
Sleep(s);
#else
usleep(s1000);
#endif
}
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
cout << "动画播放完毕(总时长约5秒)!"<<endl;
}
这里空空如也
















有帮助,赞一个