- BC20270022's blog
c++
- 4 months ago @
//分解质因数
void c(int x){
for(int i=2;i<=x;i++)
while(x%i==0){
cout<<i;
x/=i;
if(x-1)cout<<"*";
}
}
//分解因数
void c(int x){
for(int i=1;i<=x;i++)
if(x%i==0){
cout<<i;
if(x!=i)cout<<",";
}
}
//四舍五入
double p(double x,double c){//数,精度
x=int(x/c*10);
if(int(x)%10<5)x=int(x/10);
else x=int(x/10+1);
return x*c;
}
//旋转仪
#include<bits/stdc++.h>
#include<Windows.h>
#include<conio.h>
using namespace std;
void gotoxy(short x, short y) {
COORD coord = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
int main() {
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
system("color F0");
string a="林知行";
int speed;
printf("速度:\v");
cin>>speed;
for(;;){
cls
gotoxy(8,4);
for(int i=0;i<a.size();i++)putchar(a[i]);
sleep(speed);
cls
for(int i=0;i<a.size();i++){
gotoxy(9,i+2);
putchar(a[i]);
}
sleep(speed);
cls
gotoxy(8,4);
for(int i=a.size();i--;)putchar(a[i]);
sleep(speed);
cls
for(int i=a.size();i--;){
gotoxy(9,a.size()+2-i);
putchar(a[i]);
}
sleep(speed);
}
}
By signing up a HFOJ universal account, you can submit code and join discussions in all online judging services provided by us.